<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _realpath(self, relpath):
 """Follow symlinks to find the real path to a file or directory in the repo. :returns: if the expanded path points to a file, the relative path to that file; if a directory, the relative path + '/'; if a symlink outside the repo, a path starting with / or ../. """

    obj, path_so_far = self._read_object(relpath, MAX_SYMLINKS_IN_REALPATH)
    if isinstance(obj, self.Symlink):
      raise self.SymlinkLoopException(self.rev, relpath)
    return path_so_far