def flatten(y):
    """
    Recursively flattens a list.

    ##### Examples

    ```python
    >>> flatten([[1],[2,[3]],4])
    [1, 2, 3, 4]

    ```
    """
    if isinstance(y, list):
        return [z for x in y for z in flatten(x)]
    else:
        return [y]