def flatten(data):
    """ Flatten list of tuples or tuple of tuples
    Args:
        data (list or tuple): list/tuple of data to flatten
    Returns:
        list: flattened list
    """
    result = []
    for var in data:
        if isinstance(var, tuple):
            result = flatten(var)
        else:
            result.append(var)

    return result