def find_rule_bypacket(self, context, packet_bbuf):
    ' returns a compression rule or an fragmentation rule\n        in the context matching with the field value of rule id in the packet.\n        '
    for k in ['fragSender', 'fragReceiver', 'fragSender2', 'fragReceiver2', 'comp']:
        r = context.get(k)
        if (r is not None):
            rule_id = packet_bbuf.get_bits(r['ruleLength'], position=0)
            if (r['ruleID'] == rule_id):
                print('--------------------RuleManage------------------')
                print('ruleID ', rule_id)
                print()
                print('--------------------------------------------------')
                return (k, r)
    return (None, None)
returns a compression rule or an fragmentation rule
in the context matching with the field value of rule id in the packet.
def find_rule_bypacket(self, context, packet_bbuf):
    ' returns a compression rule or an fragmentation rule\n        in the context matching with the field value of rule id in the packet.\n        '
    for k in ['fragSender', 'fragReceiver', 'fragSender2', 'fragReceiver2', 'comp']:
        r = context.get(k)
        if (r is not None):
            rule_id = packet_bbuf.get_bits(r['ruleLength'], position=0)
            if (r['ruleID'] == rule_id):
                print('--------------------RuleManage------------------')
                print('ruleID ', rule_id)
                print()
                print('--------------------------------------------------')
                return (k, r)
    return (None, None)