def flatten_list(root):
    """Flatten the given list.

    All the non-list elements would be aggregated to the root-level,
    with the same order as they appear in the original list.

    Parameters
    ----------
    root : collections.Iterable[any]
        The list to be flatten.

    Returns
    -------
    list[any]
    """
    ret = []
    try:
        stack = list(reversed(root))
    except TypeError:
        stack = [root]
    while stack:
        u = stack.pop()
        if isinstance(u, list):
            for v in reversed(u):
                stack.append(v)
        else:
            ret.append(u)
    return ret