def METHOD_NAME():
    """Generate CSV records."""
    def _process_item_types_libs_locs(csv_data):
        """Process item types, library and locations data.
        :param csv_data: Dictionary of data.
        """
        itty_pid = csv_data.get('item_type_pid')
        csv_data['item_type'] = self\
            .get_resource(ItemTypesSearch(), itty_pid)\
            .get('name')
        # temporary item_type
        if itty_pid := csv_data.pop('temporary_item_type_pid', None):
            csv_data['temporary_item_type'] = self\
                .get_resource(ItemTypesSearch(), itty_pid)\
                .get('name')
        # library
        lib_pid = csv_data.pop('item_library_pid')
        csv_data['item_library_name'] = self\
            .get_resource(LibrariesSearch(), lib_pid)\
            .get('name')
        # location
        loc_pid = csv_data.pop('item_location_pid')
        csv_data['item_location_name'] = self\
            .get_resource(LocationsSearch(), loc_pid)\
            .get('name')
    headers = dict.fromkeys(self.csv_included_fields)
    # write the CSV output in memory
    line = Line()
    writer = DictWriter(line, quoting=QUOTE_ALL, fieldnames=headers)
    writer.writeheader()
    yield line.read()
    for pids, batch_results in Collector.batch(results=search_result):
        # get documents
        documents = Collector.get_documents_by_item_pids(
            item_pids=pids, language=language)
        # get loans
        items_stats = Collector.get_loans_by_item_pids(item_pids=pids)
        for hit in batch_results:
            csv_data = Collector.get_item_data(hit)
            # _process_item_types_libs_locs(self, csv_data)
            _process_item_types_libs_locs(csv_data)
            Collector.append_document_data(csv_data, documents)
            Collector.append_local_fields(csv_data)
            # update csv data with loan
            Collector.append_loan_data(hit, csv_data, items_stats)
            Collector.append_issue_data(hit, csv_data)
            # write csv data
            data = self.process_dict(dictionary=csv_data)
            writer.writerow(data)
            yield line.read()