'Constructor. JID can be specified as string (jid argument) or as separate parts.
Examples:
JID(\'node@domain/resource\')
JID(node=\'node\',domain=\'domain.org\')'

def __init__(self, jid=None, node='', domain='', resource=''):

    if ((not jid) and (not domain)):
        raise ValueError('JID    must    contain    at    least    domain    name')
    elif (type(jid) == type(self)):
        (self.node, self.domain, self.resource) = (jid.node, jid.domain, jid.resource)
    elif domain:
        (self.node, self.domain, self.resource) = (node, domain, resource)
    else:
        if (jid.find('@') + 1):
            (self.node, jid) = jid.split('@', 1)
        else:
            self.node = ''
        if (jid.find('/') + 1):
            (self.domain, self.resource) = jid.split('/', 1)
        else:
            (self.domain, self.resource) = (jid, '')
