code: def _to_relative_path(cls, parent_repo, path):
          
          path = to_native_path_linux(path)
          if path.endswith('/'):
              path = path[:-1]
          # END handle trailing slash
  
          if osp.isabs(path):
              working_tree_linux = to_native_path_linux(parent_repo.working_tree_dir)
              if not path.startswith(working_tree_linux):
                  raise ValueError("Submodule checkout path '%s' needs to be within the parents repository at '%s'"
                                   % (working_tree_linux, path))
              path = path[len(working_tree_linux.rstrip('/')) + 1:]
              if not path:
                  raise ValueError("Absolute submodule path '%s' didn't yield a valid relative path" % path)
              # end verify converted relative path makes sense
          # end convert to a relative path
  
          return path
docs: :return: a path guaranteed  to be relative to the given parent-repository
          :raise ValueError: if path is not contained in the parent repository's working tree