#NEWLINE# @ classmethod #NEWLINE# def _volume_attachment_get_state( cls , volume_id ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# data = cls . client . describe_volumes ( VolumeIds = [ volume_id ] ) #NEWLINE# volume = data [ 'Volumes' ] [ 0 ] #NEWLINE# if ( ( 'Attachments' in volume ) and ( len ( volume [ 'Attachments' ] ) > 0 ) ) : #NEWLINE# #INDENT# return volume [ 'Attachments' ] [ 0 ] [ 'State' ] #NEWLINE# #UNINDENT# raise exceptions . NotFound ( ) #NEWLINE# #UNINDENT# except botocore . exceptions . ClientError : #NEWLINE# #INDENT# error_code = sys . exc_info ( ) [ 1 ] . response [ 'Error' ] [ 'Code' ] #NEWLINE# if ( error_code == 'InvalidVolume.NotFound' ) : #NEWLINE# #INDENT# raise exceptions . NotFound ( ) #NEWLINE# #UNINDENT# raise