code: def short_path(path, cwd=None):
      
      if not isinstance(path, str):
          return path
      if cwd is None:
          cwd = os.getcwd()
      abspath = os.path.abspath(path)
      relpath = os.path.relpath(path, cwd)
      if len(abspath) <= len(relpath):
          return abspath
      return relpath
docs: Return relative or absolute path name, whichever is shortest.