Add a row to the batch. If the current batch meets one of the size
        limits, the batch is sent synchronously.

        For example:

        .. literalinclude:: snippets.py
            :start-after: [START bigtable_batcher_mutate]
            :end-before: [END bigtable_batcher_mutate]

        :type row: class
        :param row: class:`~google.cloud.bigtable.row.DirectRow`.

        :raises: One of the following:
                 * :exc:`~.table._BigtableRetryableError` if any
                   row returned a transient error.
                 * :exc:`RuntimeError` if the number of responses doesn't
                   match the number of rows that were retried
                 * :exc:`.batcher.MaxMutationsError` if any row exceeds max
                   mutations count.

def mutate(self, row):
        """ Add a row to the batch. If the current batch meets one of the size
        limits, the batch is sent synchronously.

        For example:

        .. literalinclude:: snippets.py
            :start-after: [START bigtable_batcher_mutate]
            :end-before: [END bigtable_batcher_mutate]

        :type row: class
        :param row: class:`~google.cloud.bigtable.row.DirectRow`.

        :raises: One of the following:
                 * :exc:`~.table._BigtableRetryableError` if any
                   row returned a transient error.
                 * :exc:`RuntimeError` if the number of responses doesn't
                   match the number of rows that were retried
                 * :exc:`.batcher.MaxMutationsError` if any row exceeds max
                   mutations count.
        """
        mutation_count = len(row._get_mutations())
        if mutation_count > MAX_MUTATIONS:
            raise MaxMutationsError(
                "The row key {} exceeds the number of mutations {}.".format(
                    row.row_key, mutation_count
                )
            )

        if (self.total_mutation_count + mutation_count) >= MAX_MUTATIONS:
            self.flush()

        self.rows.append(row)
        self.total_mutation_count += mutation_count
        self.total_size += row.get_mutations_size()

        if self.total_size >= self.max_row_bytes or len(self.rows) >= self.flush_count:
            self.flush()