def flatten_list(L):
    """
    Flattens the given list.

    Remark:
        If we want to allow for tuples, use:
            if isinstance(element, (list, tuple)):
        If we don't want to allow for inherited subclasses of list, use:
            if type(element) == list
    """
    flattened = []
    for element in L:
        if isinstance(element, list):
            flattened.extend(flatten_list(element))
        else:
            flattened.append(element)
    return flattened