code: def begin(self):
          
          if not self._multi_use:
              raise ValueError("Cannot call 'begin' on single-use snapshots")
  
          if self._transaction_id is not None:
              raise ValueError("Read-only transaction already begun")
  
          if self._read_request_count > 0:
              raise ValueError("Read-only transaction already pending")
  
          database = self._session._database
          api = database.spanner_api
          metadata = _metadata_with_prefix(database.name)
          txn_selector = self._make_txn_selector()
          response = api.begin_transaction(
              self._session.name, txn_selector.begin, metadata=metadata
          )
          self._transaction_id = response.id
          return self._transaction_id
docs: Begin a read-only transaction on the database.
  
          :rtype: bytes
          :returns: the ID for the newly-begun transaction.
  
          :raises ValueError:
              if the transaction is already begun, committed, or rolled back.