def unnest(tup):
    """ Unnests a nested tuple. If an element is insight nested lists, the function
    returns the element, otherwise the list is returned.

    Parameters
    ----------
    tup : list
        Nested tuples.

    Returns
    -------
    object
        Element or list without unneccessary nesting.

    """
    while True:
        if not isinstance(tup, list):
            return tup
        if len(tup) != 1:
            return tup
        
        tup = tup[0]