def send_execute_request(self, socket, code, silent=True, subheader=None, ident=None):
if self._closed:<EOL><INDENT>raise RuntimeError("<STR_LIT>")<EOL><DEDENT>subheader = subheader if subheader is not None else {}<EOL>if not isinstance(code, str):<EOL><INDENT>raise TypeError("<STR_LIT>" % type(code))<EOL><DEDENT>if not isinstance(subheader, dict):<EOL><INDENT>raise TypeError("<STR_LIT>" % type(subheader))<EOL><DEDENT>content = dict(code=code, silent=bool(silent), user_variables=[], user_expressions={})<EOL>msg = self.session.send(socket, "<STR_LIT>", content=content, ident=ident,<EOL>subheader=subheader)<EOL>msg_id = msg['<STR_LIT>']['<STR_LIT>']<EOL>self.outstanding.add(msg_id)<EOL>if ident:<EOL><INDENT>if isinstance(ident, list):<EOL><INDENT>ident = ident[-<NUM_LIT:1>]<EOL><DEDENT>if ident in list(self._engines.values()):<EOL><INDENT>self._outstanding_dict[ident].add(msg_id)<EOL><DEDENT><DEDENT>self.history.append(msg_id)<EOL>self.metadata[msg_id]['<STR_LIT>'] = datetime.now()<EOL>return msg<EOL>
construct and send an execute request via a socket.