<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def write(self, obj, resource_id=None):
 """Write and obj in bdb. :param obj: value to be written in bdb. :param resource_id: id to make possible read and search for an resource. :return: id of the transaction """

        if resource_id is not None:
            if self.read(resource_id):
                raise ValueError("There are one object already with this id.")
            obj['_id'] = resource_id
        prepared_creation_tx = self.driver.instance.transactions.prepare(
            operation='CREATE',
            signers=self.user.public_key,
            asset={
                'namespace': self.namespace,
                'data': obj
            },
            metadata={
                'namespace': self.namespace,
                'data': obj
            }
        )

        signed_tx = self.driver.instance.transactions.fulfill(
            prepared_creation_tx,
            private_keys=self.user.private_key
        )
        self.logger.debug('bdb::write::{}'.format(signed_tx['id']))
        self.driver.instance.transactions.send_commit(signed_tx)
        return signed_tx