#NEWLINE# def get_snapshot( vm_obj , snapshot_id ) : #NEWLINE# #INDENT# regex = '[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}' #NEWLINE# if re . match ( regex , snapshot_id , re . I ) : #NEWLINE# #INDENT# for snap in vm_obj . get_snapshots ( ) : #NEWLINE# #INDENT# if ( snap . get_description ( ) == snapshot_id ) : #NEWLINE# #INDENT# return snap #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# for snap in vm_obj . get_snapshots ( ) : #NEWLINE# #INDENT# if ( snap . get_name ( ) == snapshot_id ) : #NEWLINE# #INDENT# return snap