def work(self, socket, call, args, kwargs, topics=()):
task_id = uuid4_bytes()<EOL>reply_socket, topics = self.replier(socket, topics, call.reply_to)<EOL>if reply_socket:<EOL><INDENT>channel = (call.call_id, task_id, topics)<EOL><DEDENT>else:<EOL><INDENT>channel = (None, None, None)<EOL><DEDENT>f, rpc_spec = self.find_call_target(call)<EOL>if rpc_spec.reject_if.__get__(self.app)(call, topics):<EOL><INDENT>reply_socket and self.reject(reply_socket, call.call_id, topics)<EOL>return<EOL><DEDENT>reply_socket and self.accept(reply_socket, channel)<EOL>success = False<EOL>with self.catch_exceptions():<EOL><INDENT>try:<EOL><INDENT>val = self.call(call, args, kwargs, f, rpc_spec)<EOL><DEDENT>except:<EOL><INDENT>exc_info = sys.exc_info()<EOL>self.raise_(reply_socket, channel, exc_info)<EOL>reraise(*exc_info)<EOL><DEDENT>success = True<EOL><DEDENT>if not success:<EOL><INDENT>return<EOL><DEDENT>if isinstance(val, Iterator):<EOL><INDENT>vals = val<EOL>with self.catch_exceptions():<EOL><INDENT>try:<EOL><INDENT>try:<EOL><INDENT>val = next(vals)<EOL><DEDENT>except StopIteration:<EOL><INDENT>pass<EOL><DEDENT>else:<EOL><INDENT>self.send_reply(reply_socket, YIELD, val, *channel)<EOL>for val in vals:<EOL><INDENT>self.send_reply(reply_socket, YIELD, val, *channel)<EOL><DEDENT><DEDENT>self.send_reply(reply_socket, BREAK, None, *channel)<EOL><DEDENT>except:<EOL><INDENT>exc_info = sys.exc_info()<EOL>self.raise_(reply_socket, channel, exc_info)<EOL>reraise(*exc_info)<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>self.send_reply(reply_socket, RETURN, val, *channel)<EOL><DEDENT>
Calls a function and send results to the collector.  It supports
        all of function actions.  A function could return, yield, raise any
        packable objects.