import functools


def flatten(r):
    items = (flatten(i) if type(i) is list else [i] for i in r)
    return functools.reduce(list.__add__, items)

f61d2424698a9d8567716caaf5459bb2f4196b9a
<mask token>

<mask token>


def flatten(r):
    items = (flatten(i) if type(i) is list else [i] for i in r)
    return functools.reduce(list.__add__, items)

import functools


def flatten(r):
    items = (flatten(i) if type(i) is list else [i] for i in r)
    return functools.reduce(list.__add__, items)
