def _match_message(key, value, event):
    """Return true if `key` and `value` exist within the given message."""
    if key == 'datapath_id' and value is None:
        return True
    val = str(value).upper()
    msg = event['msg']
    if key in msg:
        return str(msg[key]).upper() == val
    pkt = msg.get('pkt')
    if pkt is not None and key in pkt:
        return str(pkt[key]).upper() == val
    return False
