#NEWLINE# def get_key( bucket , obj ) : #NEWLINE# #INDENT# '\n    Get a key from a bucket\n\n    :param bucket: The ``boto.s3.Bucket``\n    :param obj: Object to get the key for\n    :raises: ``glance_store.exceptions.NotFound`` if key is not found.\n    ' #NEWLINE# key = bucket . get_key ( obj ) #NEWLINE# if ( ( not key ) or ( not key . exists ( ) ) ) : #NEWLINE# #INDENT# msg = ( _ ( 'Could not find key %(obj)s in bucket %(bucket)s' ) % { #NEWLINE# #INDENT# 'obj' : msg , #NEWLINE# 'bucket' : bucket , #NEWLINE# #UNINDENT# } ) #NEWLINE# LOG . debug ( msg ) #NEWLINE# raise exceptions . NotFound ( message = msg ) #NEWLINE# #UNINDENT# return key