def handler_for_name(fq_name):
 resolved_name = for_name(fq_name)
 if isinstance(resolved_name, (type, types.ClassType)):
  return resolved_name()
 elif isinstance(resolved_name, types.MethodType):
  return getattr(resolved_name.im_class(), resolved_name.__name__)
 else:
  return resolved_name

def handler_for_name ( fq_name ) : resolved_name = for_name ( fq_name ) if isinstance ( resolved_name , ( type , types . ClassType ) ) : return resolved_name ( ) elif isinstance ( resolved_name , types . MethodType ) : return getattr ( resolved_name . im_class ( ) , resolved_name . __name__ ) else : return resolved_name
resolves and instantiates handler by fully qualified name .