def execute(code='<STR_LIT>', **kwargs):
shell = KM.shell_channel<EOL>sub = KM.sub_channel<EOL>msg_id = shell.execute(code=code, **kwargs)<EOL>reply = shell.get_msg(timeout=<NUM_LIT:2>)<EOL>list(validate_message(reply, '<STR_LIT>', msg_id))<EOL>busy = sub.get_msg(timeout=<NUM_LIT:2>)<EOL>list(validate_message(busy, '<STR_LIT:status>', msg_id))<EOL>nt.assert_equals(busy['<STR_LIT:content>']['<STR_LIT>'], '<STR_LIT>')<EOL>if not kwargs.get('<STR_LIT>'):<EOL><INDENT>pyin = sub.get_msg(timeout=<NUM_LIT:2>)<EOL>list(validate_message(pyin, '<STR_LIT>', msg_id))<EOL>nt.assert_equals(pyin['<STR_LIT:content>']['<STR_LIT:code>'], code)<EOL><DEDENT>return msg_id, reply['<STR_LIT:content>']<EOL>
wrapper for doing common steps for validating an execution request