def flatten(sequence):
    """Turn a list containing other lists into a single list"""

    try:
        l = []
        for i in sequence:
            l.extend(flatten(i))
    except:
        l = sequence
    return l