def METHOD_NAME(self, bank_lines, seq_batch):
    """
    Generates and returns a batch object with the cnab output data.
    """
    pay_order = bank_lines[0].order_id
    payment_way_id = bank_lines[0].cnab_payment_way_id
    type_code = bank_lines[0].service_type
    batch = CnabBatch()
    # HEADER
    batch.header = self.get_header().METHOD_NAME(
        pay_order,
        RecordType.HEADER_BATCH,
        seq_batch=seq_batch,
        payment_way_code=payment_way_id.code,
        patment_type_code=type_code,
    )
    # DETAIL RECORDS
    for count, bank_line in enumerate(bank_lines, 1):
        detail_record = CnabDetailRecord(name=str(count))
        for segment_t in self.get_segments():
            if segment_t.is_requerid(payment_way_id):
                segment = segment_t.METHOD_NAME(
                    bank_line,
                    RecordType.DETAIL_RECORD,
                    seq_batch=seq_batch,
                    seq_record_detail=count,
                )
                detail_record.segments.append(segment)
        batch.detail_records.append(detail_record)
    # TRAILER
    batch.trailer = self.get_trailer().METHOD_NAME(
        pay_order,
        RecordType.TRAILER_BATCH,
        seq_batch=seq_batch,
        qty_records=batch.len_records(),
        batch_detail_lines=batch.detail_lines(),
    )
    return batch