def output_list(masterlist):
    """
    Helper function that removes the extra brackets when outputting a list of lists into a csv file.
    Stackoverflow link: https://stackoverflow.com/questions/31587784/python-list-write-to-csv-without-the-square-brackets

    Keywords:
    masterList (list): input list of lists

    Returns:
    list: output list
    """

    output = []
    for item in masterlist:

        # check if item is a list
        if isinstance(item, list):

            # Append each item inside the list of list
            for i in output_list(item):
                output.append(i)

        # Otherwise just append the item (if not inside list of list)
        else:
            output.append(item)

    # return a single list without the nested lists
    return output