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

def reporting_print_x_fields(self, collection, report_name, report_type, report_fields, 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 = []
    fields_list = report_fields.replace('    ', '').split(',')
    for x in collection:
        if (x.ITEM_TYPE == 'settings'):
            structure = x.to_dict()
        else:
            structure = x.to_list()
        item = self.fielder(structure, fields_list)
        data.append(item)
    self.print_formatted_data(data=data, order=fields_list, report_type=report_type, noheaders=report_noheaders)
