def get_prefix_path(path, delimiter='/'):
    """get dirname-equivalent path prefix for a given delimiter"""
    if path == delimiter:
        return path
    split_path = path.rstrip(delimiter).split(delimiter)
    if len(split_path) <= 2:
        return delimiter
    else:
        return delimiter.join(split_path[:-1])
