'Create and send a command stanza, without using the provided
workflow management APIs.
Arguments:
jid       -- The JID to send the command request or result.
node      -- The node for the command.
ifrom     -- Specify the sender\'s JID.
action    -- May be one of: execute, cancel, complete,
or cancel.
payload   -- Either a list of payload items, or a single
payload item such as a data form.
sessionid -- The current session\'s ID value.
flow      -- If True, process the Iq result using the
command workflow methods contained in the
session instead of returning the response
stanza itself. Defaults to False.
block     -- Specify if the send call will block until a
response is received, or a timeout occurs.
Defaults to True.
timeout   -- The length of time (in seconds) to wait for a
response before exiting the send call
if blocking is used. Defaults to
sleekxmpp.xmlstream.RESPONSE_TIMEOUT
callback  -- Optional reference to a stream handler
function. Will be executed when a reply
stanza is received if flow=False.'

def send_command(self, jid, node, ifrom=None, action='execute', payload=None, sessionid=None, flow=False, **kwargs):

    iq = self.xmpp.Iq()
    iq['type'] = 'set'
    iq['to'] = jid
    iq['from'] = ifrom
    iq['command']['node'] = node
    iq['command']['action'] = action
    if (sessionid is not None):
        iq['command']['sessionid'] = sessionid
    if (payload is not None):
        if (not isinstance(payload, list)):
            payload = [payload]
        for item in payload:
            iq['command'].append(item)
    if (not flow):
        return iq.send(**kwargs)
    elif kwargs.get('block', True):
        try:
            result = iq.send(**kwargs)
        except IqError as err:
            result = err.iq
        self._handle_command_result(result)
    else:
        iq.send(block=False, callback=self._handle_command_result)
