'Prints all fields in a collection as a table given the report type'

def reporting_print_all_fields(self, collection, report_name, report_type, report_noheaders):

    if report_name:
        collection = collection.find(name=report_name)
        if collection:
            collection = [collection]
        else:
            return
    collection = [x for x in collection]
    collection.sort(self.reporting_sorter)
    data = []
    out_order = []
    count = 0
    for x in collection:
        item = {}
        if (x.ITEM_TYPE == 'settings'):
            structure = x.to_dict()
        else:
            structure = x.to_list()
        for (key, value) in structure.iteritems():
            if (key == 'interfaces'):
                for (device, info) in value.iteritems():
                    for (info_header, info_value) in info.iteritems():
                        item[info_header] = ((str(device) + ':    ') + str(info_value))
                        if (count == 0):
                            out_order.append(info_header)
            else:
                item[key] = value
                if (count == 0):
                    out_order.append(key)
        count = (count + 1)
        data.append(item)
    self.print_formatted_data(data=data, order=out_order, report_type=report_type, noheaders=report_noheaders)
