import typing


def get_hierarchy_level(
    hierarchy: str, hierarchy_level: int
) -> typing.Union[str, None]:
    """
    Split the hierarchy into levels and return the selected level.

    :param hierarchy:
        Raw hierarchy string.
    :param hierarchy_level:
        Level of the hierarchy to return. Index is zero-based.
    :return:
        Specified hierarchy level.
    """
    levels = hierarchy.split("::") if hierarchy else []

    return levels[hierarchy_level] if len(levels) > hierarchy_level else None