code: def get_transaction_id(transaction, read_operation=True):
      
      if transaction is None:
          return None
      else:
          if not transaction.in_progress:
              raise ValueError(INACTIVE_TXN)
          if read_operation and len(transaction._write_pbs) > 0:
              raise ReadAfterWriteError(READ_AFTER_WRITE_ERROR)
          return transaction.id
docs: Get the transaction ID from a ``Transaction`` object.
  
      Args:
          transaction (Optional[~.firestore_v1beta1.transaction.\
              Transaction]): An existing transaction that this query will
              run in.
          read_operation (Optional[bool]): Indicates if the transaction ID
              will be used in a read operation. Defaults to :data:`True`.
  
      Returns:
          Optional[bytes]: The ID of the transaction, or :data:`None` if the
          ``transaction`` is :data:`None`.
  
      Raises:
          ValueError: If the ``transaction`` is not in progress (only if
              ``transaction`` is not :data:`None`).
          ReadAfterWriteError: If the ``transaction`` has writes stored on
              it and ``read_operation`` is :data:`True`.