def _get_level(path):
    """Determine the number of sub directories `path` is contained in

    Args:
        path (string): The target path

    Returns:
        int: The directory depth of `path`
    """
    normalized = path

    # This for loop ensures there are no double `//` substrings.
    # A for loop is used because there's not currently a `while`
    # or a better mechanism for guaranteeing all `//` have been
    # cleaned up.
    for i in range(len(path)):
        new_normalized = normalized.replace("//", "/")
        if len(new_normalized) == len(normalized):
            break
        normalized = new_normalized

    return normalized.count("/")