def multiply(list_):
    for index, item in enumerate(list_):
        if isinstance(item, MutableSequence):
            pass
Python: Iterating lists with different amount of dimensions, is there a generic way?