def _create_context_manager(self, mode):
class mode_context_manager(object):<EOL><INDENT>def __enter__(*a):<EOL><INDENT>self.send_packet({'<STR_LIT>': '<STR_LIT>', '<STR_LIT:data>': mode})<EOL><DEDENT>def __exit__(*a):<EOL><INDENT>self.send_packet({'<STR_LIT>': '<STR_LIT>', '<STR_LIT:data>': '<STR_LIT>'})<EOL><DEDENT><DEDENT>return mode_context_manager()<EOL>
Create a context manager that sends 'mode' commands to the client.