code: def parse_xml(self, node):
          
          self._set_properties(node)
          self.background_color = node.get('backgroundcolor',
                                           self.background_color)
  
          # ***         do not change this load order!         *** #
          # ***    gid mapping errors will occur if changed    *** #
          for subnode in node.findall('layer'):
              self.add_layer(TiledTileLayer(self, subnode))
  
          for subnode in node.findall('imagelayer'):
              self.add_layer(TiledImageLayer(self, subnode))
  
          for subnode in node.findall('objectgroup'):
              self.add_layer(TiledObjectGroup(self, subnode))
  
          for subnode in node.findall('tileset'):
              self.add_tileset(TiledTileset(self, subnode))
  
          # "tile objects", objects with a GID, have need to have their attributes
          # set after the tileset is loaded, so this step must be performed last
          # also, this step is performed for objects to load their tiles.
  
          # tiled stores the origin of GID objects by the lower right corner
          # this is different for all other types, so i just adjust it here
          # so all types loaded with pytmx are uniform.
  
          # iterate through tile objects and handle the image
          for o in [o for o in self.objects if o.gid]:
  
              # gids might also have properties assigned to them
              # in that case, assign the gid properties to the object as well
              p = self.get_tile_properties_by_gid(o.gid)
              if p:
                  for key in p:
                      o.properties.setdefault(key, p[key])
  
              if self.invert_y:
                  o.y -= o.height
  
          self.reload_images()
          return self
docs: Parse a map from ElementTree xml node
  
          :param node: ElementTree xml node
          :return: self