def split_dirname(dirname):
    """Splits the capitalized suffix out from the given directories.

    Looks for the longest suffix that is CamelCased;
    specifically, where each directory starts with a capitalized letter.

    See go/haskell-standard-names for the motivation of this scheme.

    For example:
        split_dirname("abc/Def/Ghi") == ("abc", "Def/Ghi")
        split_dirname("abc/def") == ("abc/def", "")

    Args:
      dirname: A string; a path of directories separated by "/".

    Returns:
      A pair of (prefix, suffix) strings.
    """
    dirs = dirname.split("/")

    for i in range(len(dirs) - 1, -1, -1):
        if not dirs[i][0:1].isupper():  # Make sure to exclude symbols
            return ("/".join(dirs[0:(i + 1)]), "/".join(dirs[(i + 1):]))

    # Every component is lower-cased:
    return (dirname, "")