code: def GetRelativePathForPathSpec(cls, path_spec, mount_path=None):
      
      if not path_spec:
        return None
  
      # TODO: Solve this differently, quite possibly inside dfVFS using mount
      # path spec.
      location = getattr(path_spec, 'location', None)
      if not location and path_spec.HasParent():
        location = getattr(path_spec.parent, 'location', None)
  
      if not location:
        return None
  
      data_stream = getattr(path_spec, 'data_stream', None)
      if data_stream:
        location = '{0:s}:{1:s}'.format(location, data_stream)
  
      if path_spec.type_indicator != dfvfs_definitions.TYPE_INDICATOR_OS:
        return location
  
      # If we are parsing a mount point we don't want to include the full
      # path to file's location here, we are only interested in the path
      # relative to the mount point.
      if mount_path and location.startswith(mount_path):
        location = location[len(mount_path):]
  
      return location
docs: Retrieves the relative path of a path specification.
  
      If a mount path is defined the path will be relative to the mount point,
      otherwise the path is relative to the root of the file system that is used
      by the path specification.
  
      Args:
        path_spec (dfvfs.PathSpec): path specification.
        mount_path (Optional[str]): path where the file system that is used
            by the path specification is mounted, such as "/mnt/image". The
            mount path will be stripped from the absolute path defined by
            the path specification.
  
      Returns:
        str: relative path or None.