def get_basedir(path):
 return (path[:path.index(os.sep)] if (os.sep in path) else path)

def get_basedir ( path ) : return ( path [ : path . index ( os . sep ) ] if ( os . sep in path ) else path )
returns the base directory of a path .