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

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
return relative or absolute path name .