def METHOD_NAME(type_hint: type) -> List[type]:
    type_hints = [type_hint]
    ret = []
    while len(type_hints) > 0:
        type_hint = type_hints.pop(0)
        origin: type = get_origin(type_hint)
        ret.append(origin)
        if origin is list:
            args = get_args(type_hint)
            if len(args) != 1:
                raise IllegalFormatException(f"Invalid type: {type_hint}")
            type_hints.append(args[0])
        elif origin is Union:
            args = get_args(type_hint)
            if not (len(args) == 2 and args[1] is type(None)):
                raise IllegalFormatException(f"Invalid type: {type_hint}")
            type_hints.append(args[0])
    return ret