def pick_flavor(flavors):
 for flavor_priority in ('m1.nano', 'm1.micro', 'm1.tiny', 'm1.small'):
  for flavor in flavors:
   if (flavor.name == flavor_priority):
    return flavor
 raise NoFlavorException()

def pick_flavor ( flavors ) : for flavor_priority in ( 'm1.nano' , 'm1.micro' , 'm1.tiny' , 'm1.small' ) : for flavor in flavors : if ( flavor . name == flavor_priority ) : return flavor raise NoFlavorException ( )
given a flavor list pick a reasonable one .