'Instantiate a BucketStorageUri from the current BucketStorageUri, by
replacing the object name with the object name and other metadata found
in the given Key object (including generation).
@type key: Key
@param key: key for the new StorageUri to represent'

def clone_replace_key(self, key):

    self._check_bucket_uri('clone_replace_key')
    version_id = None
    generation = None
    is_latest = False
    if hasattr(key, 'version_id'):
        version_id = key.version_id
    if hasattr(key, 'generation'):
        generation = key.generation
    if hasattr(key, 'is_latest'):
        is_latest = key.is_latest
    return BucketStorageUri(key.provider.get_provider_name(), bucket_name=key.bucket.name, object_name=key.name, debug=self.debug, suppress_consec_slashes=self.suppress_consec_slashes, version_id=version_id, generation=generation, is_latest=is_latest)
