code: def get_basedir(path):
    
    return path[:path.index(os.sep)] if os.sep in path else path
docs: Returns the base directory of a path.
  
    Examples:
      get_basedir('foo/bar/baz') --> 'foo'
      get_basedir('/foo/bar/baz') --> ''
      get_basedir('foo') --> 'foo'