def define_service(service_descriptor, module):
 class_dict = {'__module__': module.__name__}
 class_name = service_descriptor.name.encode('utf-8')
 for method_descriptor in (service_descriptor.methods or []):
  request_definition = messages.find_definition(method_descriptor.request_type, module)
  response_definition = messages.find_definition(method_descriptor.response_type, module)
  method_name = method_descriptor.name.encode('utf-8')
  def remote_method(self, request):
   'Actual service method.'
   raise NotImplementedError('Method is not implemented')
  remote_method.__name__ = method_name
  remote_method_decorator = remote.method(request_definition, response_definition)
  class_dict[method_name] = remote_method_decorator(remote_method)
 service_class = type(class_name, (remote.Service,), class_dict)
 return service_class

def define_service ( service_descriptor , module ) : class_dict = { '__module__' : module . __name__ } class_name = service_descriptor . name . encode ( 'utf-8' ) for method_descriptor in ( service_descriptor . methods or [ ] ) : request_definition = messages . find_definition ( method_descriptor . request_type , module ) response_definition = messages . find_definition ( method_descriptor . response_type , module ) method_name = method_descriptor . name . encode ( 'utf-8' ) def remote_method ( self , request ) : raise NotImplementedError ( 'Method is not implemented' ) remote_method . __name__ = method_name remote_method_decorator = remote . method ( request_definition , response_definition ) class_dict [ method_name ] = remote_method_decorator ( remote_method ) service_class = type ( class_name , ( remote . Service , ) , class_dict ) return service_class
define a new service proxy .