'Send a direct MUC invitation to an XMPP entity.
Arguments:
jid      -- The JID of the entity that will receive
the invitation
roomjid  -- the address of the groupchat room to be joined
password -- a password needed for entry into a
password-protected room (OPTIONAL).
reason   -- a human-readable purpose for the invitation
(OPTIONAL).'

def send_invitation(self, jid, roomjid, password=None, reason=None, ifrom=None):

    msg = self.xmpp.Message()
    msg['to'] = jid
    if (ifrom is not None):
        msg['from'] = ifrom
    msg['groupchat_invite']['jid'] = roomjid
    if (password is not None):
        msg['groupchat_invite']['password'] = password
    if (reason is not None):
        msg['groupchat_invite']['reason'] = reason
    return msg.send()
