from typing import List
from typing import Any


def _remove_single_element_groups(hierarchy: List[List]) -> List[Any]:
    """
    Flatten sub-lists of length 1.

    Parameters
    ----------
    hierarchy : List[List]

    Returns
    -------
    hierarchy : list of el / lists

    Examples
    --------
    >>> hierarchy = [[0], [1, 2]]
    >>> _remove_single_element_groups(hierarchy)
    [0, [1, 2]]
    """
    h_new = []
    for el in hierarchy:
        if len(el) > 1:
            h_new.append(el)
        else:
            h_new.append(el[0])
    return h_new