def adapters_by_system_and_scope(self, system, scope):
        dhcp_scope = scope
        system = System.objects.get(hostname=system)
        keyvalue_pairs = KeyValue.objects.filter(key__startswith='nic.').filter(system=system).order_by('key')
        #Iterate through the list and get all of the key/value pairs
        tmp_dict = {}
        adapter_ids = []
        final_list = []
        for kv in keyvalue_pairs:
            tmp_dict[kv.key] = kv.value
        for k in tmp_dict.iterkeys():
            matches = re.match('nic\.(\d+).*',k)
            if matches.group is not None:
                dhcp_scope_match = 'nic.%s.dhcp_scope.0' % matches.group(1)
                ip_address_match = 'nic.%s.ipv4_address.0' % matches.group(1)
                if matches.group(1) not in adapter_ids and ip_address_match in tmp_dict and dhcp_scope_match in tmp_dict and tmp_dict[dhcp_scope_match] == dhcp_scope:
                    adapter_ids.append(matches.group(1))
        adapter_ids.sort()
        for a in adapter_ids:
            adapter_name = ''
            mac_address = ''
            dhcp_hostname = ''
            dhcp_filename = ''
            dhcp_domain_name = ''
            ipv4_address = ''
            dhcp_domain_name_servers = ''
            if 'nic.%s.ipv4_address.0' % a in tmp_dict:
                ipv4_address = tmp_dict['nic.%s.ipv4_address.0' % a]
            if 'nic.%s.name.0' % a in tmp_dict:
                adapter_name = tmp_dict['nic.%s.name.0' % a]
            if 'nic.%s.mac_address.0' % a in tmp_dict:
                mac_address = tmp_dict['nic.%s.mac_address.0' % a]
            if tmp_dict in 'nic.%s.dhcp_hostname.0' % a and 'nic.%s.option_hostname.0' % a not in tmp_dict:
                dhcp_hostname = tmp_dict['nic.%s.dhcp_hostname.0' % a]
            if  'nic.%s.option_hostname.0' % a in tmp_dict:
                dhcp_hostname = tmp_dict['nic.%s.option_hostname.0' % a]
            if 'nic.%s.dhcp_filename.0' % a in tmp_dict:
                dhcp_filename = tmp_dict['nic.%s.dhcp_filename.0' % a]
            if 'nic.%s.dhcp_domain_name.0' % a in tmp_dict:
                dhcp_domain_name = tmp_dict['nic.%s.dhcp_domain_name.0' % a]
            if 'nic.%s.dhcp_domain_name_servers.0' % a in tmp_dict:
                dhcp_domain_name_servers = tmp_dict['nic.%s.dhcp_domain_name_servers.0' % a]
            final_list.append({'system_hostname':system.hostname, 'ipv4_address':ipv4_address,  'adapter_name':adapter_name, 'mac_address':mac_address, 'option_hostname': dhcp_hostname, 'dhcp_hostname':dhcp_hostname, 'dhcp_filename':dhcp_filename, 'dhcp_domain_name':dhcp_domain_name, 'dhcp_domain_name_servers':dhcp_domain_name_servers})
        return final_list
dataset/ETHPy150Open rtucker-mozilla/mozilla_inventory/libs/DHCPHelper.py/DHCPHelper.adapters_by_system_and_scope/swapped operands of `in`