def flatten_list(input_list):
    """Flattens a nested list.
    Args:
        input_list: A (possibly) nested list.
    Returns:
        A flattened list, preserving order.
    """

    if not input_list:
        return []
    if isinstance(input_list[0], list):
        return flatten_list(input_list[0]) + flatten_list(input_list[1:])
    else:
        return input_list[:1] + flatten_list(input_list[1:])