'Initiate executing a command provided by a remote agent.
The default workflow provided is non-blocking, but a blocking
version may be used with block=True.
The provided session dictionary should contain:
next  -- A handler for processing the command result.
error -- A handler for processing any error stanzas
generated by the request.
Arguments:
jid     -- The JID to send the command request.
node    -- The node for the desired command.
session -- A dictionary of relevant session data.
ifrom   -- Optionally specify the sender\'s JID.
block   -- If True, block execution until a result
is received. Defaults to False.'

def start_command(self, jid, node, session, ifrom=None, block=False):

    session['jid'] = jid
    session['node'] = node
    session['timestamp'] = time.time()
    session['block'] = block
    if ('payload' not in session):
        session['payload'] = None
    iq = self.xmpp.Iq()
    iq['type'] = 'set'
    iq['to'] = jid
    iq['from'] = ifrom
    session['from'] = ifrom
    iq['command']['node'] = node
    iq['command']['action'] = 'execute'
    if (session['payload'] is not None):
        payload = session['payload']
        if (not isinstance(payload, list)):
            payload = list(payload)
        for stanza in payload:
            iq['command'].append(stanza)
    sessionid = ('client:pending_' + iq['id'])
    session['id'] = sessionid
    self.sessions[sessionid] = session
    if session['block']:
        try:
            result = iq.send(block=True)
        except IqError as err:
            result = err.iq
        self._handle_command_result(result)
    else:
        iq.send(block=False, callback=self._handle_command_result)
