def flatten(seq):
    """Given a nested datastructure, flatten it."""

    lst = []
    for el in seq:
        if [list, tuple, set] in type(el):
            lst.extend(flatten(el))
        else:
            lst.append(el)
    return lst
dataset/ETHPy150Open abhik/pebl/src/pebl/util.py/flatten/swapped operands of `in`