code: def from_file(self, path):
          
          for xmp_path in (path + '.xmp', path):
              md = GExiv2.Metadata()
              try:
                  md.open_path(xmp_path)
              except GLib.GError:
                  continue
              for tag in (md.get_exif_tags() +
                          md.get_iptc_tags() + md.get_xmp_tags()):
                  if md.get_tag_type(tag) in ('XmpBag', 'XmpSeq'):
                      self.data[tag] = md.get_tag_multiple(tag)
                  else:
                      self.data[tag] = md.get_tag_string(tag)
              self.comment = md.get_comment()
              break
          return self
docs: Read metadata from an XMP sidecar file or, if there is no
          sidecar, from the image/video file (if it has metadata).
  
          Returns the :py:class:`Metadata` object, allowing convenient
          code like this::
  
              md = Metadata().from_file(path)
  
          :param str path: The image/video file path name.
  
          :rtype: :py:class:`Metadata`