'Make a new command available to external entities.
Access control may be implemented in the provided handler.
Command workflow is done across a sequence of command handlers. The
first handler is given the initial Iq stanza of the request in order
to support access control. Subsequent handlers are given only the
payload items of the command. All handlers will receive the command\'s
session data.
Arguments:
jid     -- The JID that will expose the command.
node    -- The node associated with the command.
name    -- A human readable name for the command.
handler -- A function that will generate the response to the
initial command request, as well as enforcing any
access control policies.'

def add_command(self, jid=None, node=None, name='', handler=None):

    if (jid is None):
        jid = self.xmpp.boundjid
    elif (not isinstance(jid, JID)):
        jid = JID(jid)
    item_jid = jid.full
    self.xmpp['xep_0030'].add_identity(category='automation', itype='command-list', name='Ad-Hoc    commands', node=Command.namespace, jid=jid)
    self.xmpp['xep_0030'].add_item(jid=item_jid, name=name, node=Command.namespace, subnode=node, ijid=jid)
    self.xmpp['xep_0030'].add_identity(category='automation', itype='command-node', name=name, node=node, jid=jid)
    self.xmpp['xep_0030'].add_feature(Command.namespace, None, jid)
    self.commands[(item_jid, node)] = (name, handler)
