def flatten(list_a: list):
    """Problem 7: Flatten a Nested List Structure,

    Parameters
    ----------
    list_a : list
        The input list

    Returns
    -------
    flat : list
        The flattened input list

    Raises
    ------
    TypeError
        If the given argument is not of `list` type

    """
    if not isinstance(list_a, list):
        raise TypeError('The argument given is not of `list` type.')

    flat = []
    for x in list_a:
        if isinstance(x, list):
            # If element x is a list then the initial list should be
            # extended by the elements of list x
            flat.extend(flatten(x))
        else:
            # Otherwise a single element is appended
            flat.append(x)

    return flat