def dirname(path):
    """Returns the directory's name.

    Args:
      path: The path to return the directory for

    Returns:
      The directory's name.
    """
    last_sep = path.rfind("/")
    if last_sep == -1:
        return ""
    return path[:last_sep]