def _object_matcher(obj):
 if isinstance(obj, TreeElement):
  return _identity_matcher(obj)
 if isinstance(obj, type):
  return _class_matcher(obj)
 if isinstance(obj, basestring):
  return _string_matcher(obj)
 if isinstance(obj, dict):
  return _attribute_matcher(obj)
 if callable(obj):
  return _function_matcher(obj)
 raise ValueError(('%s (type %s) is not a valid type for comparison.' % (obj, type(obj))))

def _object_matcher ( obj ) : if isinstance ( obj , TreeElement ) : return _identity_matcher ( obj ) if isinstance ( obj , type ) : return _class_matcher ( obj ) if isinstance ( obj , basestring ) : return _string_matcher ( obj ) if isinstance ( obj , dict ) : return _attribute_matcher ( obj ) if callable ( obj ) : return _function_matcher ( obj ) raise ValueError ( ( '%s (type %s) is not a valid type for comparison.' % ( obj , type ( obj ) ) ) )
retrieve a matcher function by passing an arbitrary object .