'Compare the given stanza\'s ``\'id\'`` attribute to the stored
``id`` value, and verify the sender\'s JID.
:param xml: The :class:`~sleekxmpp.xmlstream.stanzabase.ElementBase`
stanza to compare against.'

def match(self, xml):

    selfjid = self._criteria['self']
    peerjid = self._criteria['peer']
    allowed = {}
    allowed[''] = True
    allowed[selfjid.bare] = True
    allowed[selfjid.host] = True
    allowed[peerjid.full] = True
    allowed[peerjid.bare] = True
    allowed[peerjid.host] = True
    _from = xml['from']
    try:
        return ((xml['id'] == self._criteria['id']) and allowed[_from])
    except KeyError:
        return False
