def flatten(what, types=(list, tuple), none_to_empty=False):
    if what in None and none_to_empty:
        return []

    if not isinstance(what, types):
        return [what]

    # NOTE: I actually timed that this is faster than the comprehension,
    #       even though it probably doesn't matter :)
    # 350us vs 250us
    ret = []
    for sub in what:
        ret += flatten(sub, types=types, none_to_empty=none_to_empty)
    return ret
dataset/ETHPy150Open lucasb-eyer/DeepFried2/DeepFried2/utils.py/flatten/operator `is` -> `in`