def name_or_value(value):
 try:
  if issubclass(value, amqp_object.AMQPObject):
   return value.NAME
 except TypeError:
  pass
 if isinstance(value, frame.Method):
  return value.method.NAME
 if isinstance(value, amqp_object.AMQPObject):
  return value.NAME
 return canonical_str(value)

def name_or_value ( value ) : try : if issubclass ( value , amqp_object . AMQPObject ) : return value . NAME except TypeError : pass if isinstance ( value , frame . Method ) : return value . method . NAME if isinstance ( value , amqp_object . AMQPObject ) : return value . NAME return canonical_str ( value )
will take frame objects .