def METHOD_NAME(bq_client, table, rows):
    """Inserts rows into a BigQuery table in batches of MAX_BQ_INSERT_SIZE each.
  Args:
    bq_client: BigQuery client
    table: table where rows must be inserted
    rows: a list of rows to insert
  """
    total_rows = len(rows)
    inserted_rows = 0
    batch = 1
    logger.info("Inserting %d rows into table %s", total_rows,
                table.full_table_id)
    while inserted_rows < total_rows:
        start = (batch - 1) * MAX_BQ_INSERT_SIZE
        end = batch * MAX_BQ_INSERT_SIZE
        batch_rows = rows[start:end]
        inserted_rows += len(batch_rows)
        errors = _insert_rows(bq_client, table, batch_rows)
        if errors:
            print_bq_insert_errors(batch_rows, errors)
            logger.error(
                "The program has been terminated due to BigQuery insertion "
                "errors.")
            exit(1)
        else:
            logger.info("Batch %d: inserted rows %d to %d", batch, start + 1,
                        min(end, len(rows)))
        batch += 1
    logger.info("All rows inserted.")