def setKeyValue(self, bucketName, keyName, value):
        """sets key 'keyName' in bucket 'bucketName' to value.

        creates the key and the bucket if they don't exist.
        """
        with self.state_.lock:
            if self.state_.writeFailureInjector is not None:
                if self.state_.writeFailureInjector(bucketName, keyName):
                    raise S3Interface.UnableToWriteKey(bucketName, keyName)

            assert isinstance(value, str)

            if bucketName not in self.state_.buckets_:
                self.state_.createBucket(bucketName, self.credentials_)

            self.state_.validateAccess(bucketName, self.credentials_)

            self.state_.buckets_[bucketName][keyName] = InMemoryS3Key(value=value,
                                                                      mtime=time.time())

        if self.state_.delayAfterWriteFunction is not None:
            delay = self.state_.delayAfterWriteFunction(bucketName, keyName)
            time.sleep(delay)
dataset/ETHPy150Open ufora/ufora/ufora/distributed/S3/InMemoryS3Interface.py/InMemoryS3Interface.setKeyValue/original