#NEWLINE# def storage_uri_for_key( key ) : #NEWLINE# #INDENT# 'Returns a StorageUri for the given key.\n\n    :type key: :class:`boto.s3.key.Key` or subclass\n    :param key: URI naming bucket + optional object.\n    ' #NEWLINE# if ( not isinstance ( key , boto . s3 . key . Key ) ) : #NEWLINE# #INDENT# raise InvalidUriError ( ( 'Requested key (%s) is not a subclass of boto.s3.key.Key' % str ( type ( key ) ) ) ) #NEWLINE# #UNINDENT# prov_name = key . bucket . connection . provider . get_provider_name ( ) #NEWLINE# uri_str = ( '%s://%s/%s' % ( prov_name , key . bucket . name , key . name ) ) #NEWLINE# return storage_uri ( uri_str )