def _unroll(seq):
    """Unroll nested sequences of stuff and return a flattened list"""
    out = []
    if isinstance(seq, (list, tuple)):
        for elem in seq:
            out.extend(_unroll(elem))
    else:
        out.append(seq)
    return out