Using animated tilemap tiles in pygame

I'm new to programming and am trying to make an animated tilemap for pygame. I noticed Tiled has an animation editor feature and I was able to put animations in the map. The problem is I don't know how to put those animations into my game in pygame. I know how to load a non-animated map from following a youtube tutorial, but I would like to know how to update the code so I can get some animated tiles. Here is my code for loading the map:

import pygame as pg
import pytmx

class TiledMap:
    def __init__(self,filename):
        tm = pytmx.load_pygame(filename,pixelalpha=True)
        self.width = tm.width * tm.tileheight
        self.height = tm.height * tm.tileheight
        self.tmxdata = tm

    def render(self, surface):
        ti = self.tmxdata.get_tile_image_by_gid
        for layer in self.tmxdata.visible_layers:
            if isinstance(layer,pytmx.TiledTileLayer):
                for x,y,gid,in layer:
                    tile = ti(gid)
                    if tile:
                        surface.blit(tile,
                                     (x*self.tmxdata.tilewidth,
                                      y*self.tmxdata.tileheight))

    def make_map(self):
        temp_surface = pg.Surface((self.width,self.height))
        self.render(temp_surface)
        return temp_surface

Any help is appreciated!