def flatten(x):
    """Flatten a list of arbitrary depth. Returns a list with no sub-lists or sub-tuples.
    If the input is not a list or a tuple, it will be returned as a one-element list.
    """
    if not isinstance(x, (list, tuple)):
        return [x]
    else:
        if len(x) == 0:
            return []
        else:
            return flatten(x[0]) + flatten(x[1:])