def try_serialize_handler(handler):
 if (isinstance(handler, types.InstanceType) or ((isinstance(handler, object) and (not inspect.isfunction(handler)) and (not inspect.ismethod(handler))) and hasattr(handler, '__call__'))):
  return pickle.dumps(handler)
 return None

def try_serialize_handler ( handler ) : if ( isinstance ( handler , types . InstanceType ) or ( ( isinstance ( handler , object ) and ( not inspect . isfunction ( handler ) ) and ( not inspect . ismethod ( handler ) ) ) and hasattr ( handler , '__call__' ) ) ) : return pickle . dumps ( handler ) return None
try to serialize map/reduce handler .