(path, toplevel_dir=None)
return RelativePath(toplevel_dir, os.path.join(toplevel_dir, path))
Given a path like foo/bar that is relative to toplevel_dir, return
  the inverse relative path back to the toplevel_dir.

  E.g. os.path.normpath(os.path.join(path, InvertRelativePath(path)))
  should always produce the empty string, unless the path contains symlinks.
Given a path like foo/bar that is relative to toplevel_dir, return
  the inverse relative path back to the toplevel_dir.
Given a path like foo / bar that is relative to toplevel_dir return the inverse relative path back to the toplevel_dir .
def InvertRelativePath(path, toplevel_dir=None):
  """Given a path like foo/bar that is relative to toplevel_dir, return
  the inverse relative path back to the toplevel_dir.

  E.g. os.path.normpath(os.path.join(path, InvertRelativePath(path)))
  should always produce the empty string, unless the path contains symlinks.
  """
  if not path:
    return path
  toplevel_dir = '.' if toplevel_dir is None else toplevel_dir
  return RelativePath(toplevel_dir, os.path.join(toplevel_dir, path))
def InvertRelativePath ( path , toplevel_dir = None ) : if not path : return path toplevel_dir = '.' if toplevel_dir is None else toplevel_dir return RelativePath ( toplevel_dir , os . path . join ( toplevel_dir , path ) )