def remote(func):
@functools.wraps(func)<EOL>def wrapper(self, *args, **kwargs):<EOL><INDENT>if self.mode == '<STR_LIT>':<EOL><INDENT>return func(self, *args, **kwargs)<EOL><DEDENT>if not self.conn:<EOL><INDENT>self.connect()<EOL><DEDENT>self.conn.send('<STR_LIT>', func.__name__, args, kwargs)<EOL>cmd, payload = self.conn.recv()<EOL>if cmd == '<STR_LIT>':<EOL><INDENT>self.close()<EOL>raise Exception("<STR_LIT>" %<EOL>payload[<NUM_LIT:0>])<EOL><DEDENT>elif cmd == '<STR_LIT>':<EOL><INDENT>exc_type = utils.find_entrypoint(None, payload[<NUM_LIT:0>])<EOL>raise exc_type(payload[<NUM_LIT:1>])<EOL><DEDENT>elif cmd != '<STR_LIT>':<EOL><INDENT>self.close()<EOL>raise Exception("<STR_LIT>" % cmd)<EOL><DEDENT>return payload[<NUM_LIT:0>]<EOL><DEDENT>wrapper._remote = True<EOL>return wrapper<EOL>
Decorator to mark a function as invoking a remote procedure call.
When invoked in server mode, the function will be called; when
invoked in client mode, an RPC will be initiated.