'Constructor.
All arguments should be specified as keyword arguments.
Args:
adapter: Optional AbstractAdapter subclass instance;
default IdentityAdapter.
config: Optional Configuration object.
transaction: Optional datastore_db.Transaction object.
entity_group: Deprecated, do not use.'

@_positional(1)
def __init__(self, adapter=None, config=None, transaction=None, entity_group=None, _api_version=_DATASTORE_V3):

    super(TransactionalConnection, self).__init__(adapter=adapter, config=config, _api_version=_api_version)
    self.__adapter = self.adapter
    self.__config = self.config
    if (transaction is None):
        app = TransactionOptions.app(self.config)
        app = datastore_types.ResolveAppId(TransactionOptions.app(self.config))
        self.__transaction_rpc = self.async_begin_transaction(None, app)
    else:
        if (self._api_version == _CLOUD_DATASTORE_V1):
            txn_class = str
        else:
            txn_class = datastore_pb.Transaction
        if (not isinstance(transaction, txn_class)):
            raise datastore_errors.BadArgumentError(('Invalid    transaction    (%r)' % transaction))
        self.__transaction = transaction
        self.__transaction_rpc = None
    self.__finished = False
    self.__pending_v1_upserts = {}
    self.__pending_v1_deletes = {}
