def delete(self, request, key_value_id=None):
        if 'key_type' in request.GET and request.GET['key_type'] == 'delete_all_network_adapters':
            #Get keystores from truth that have dhcp.is_scope = True
            try:
                system_hostname = request.GET['system_hostname']
                system = System.objects.get(hostname=system_hostname)
                KeyValue.objects.filter(key__startswith='nic', obj=system).delete()
                resp = rc.ALL_OK
                resp.write('json = {"id":"0"}')
            except:
                resp = rc.NOT_FOUND
                resp.write('json = {"error_message":"Unable to Delete}')

            return resp
        if 'key_type' in request.GET and request.GET['key_type'] == 'delete_network_adapter':
            #Get keystores from truth that have dhcp.is_scope = True
            try:
                adapter_number = request.GET['adapter_number']
                system_hostname = request.GET['system_hostname']
                system = System.objects.get(hostname=system_hostname)
                KeyValue.objects.filter(key__startswith='nic.%s' % adapter_number, obj=system).delete()
                #KeyValue.objects.filter(key__startswith='nic.0', system=system).delete()
                resp = rc.ALL_OK
                resp.write('json = {"id":"14"}')
            except:
                resp = rc.NOT_FOUND
                resp.write('json = {"error_message":"Unable to Delete}')

            return resp
        if 'key_type' in request.GET and request.GET['key_type'] == 'delete_key_by_system':
            try:
                system_hostname = request.GET.get('system')
                key = request.GET.get('key')
                system = System.objects.get(hostname=system_hostname)
                KeyValue.objects.filter(key=key, obj=system).delete()
                resp = rc.ALL_OK
                resp.write('json = {"id":"14"}')
            except:
                resp = rc.NOT_FOUND
                resp.write('json = {"error_message":"Unable to Delete}')

            return resp
        if 'key_type' not in request.GET:
            if 'system_id' in request.GET:
                try:
                    n = KeyValue.objects.get(id=key_value_id)
                    n.delete()
                    resp = rc.ALL_OK
                    resp.write('json = {"id":"%s"}' % str(key_value_id))
                except:
                    resp = rc.NOT_FOUND
                return resp
            if 'truth_id' in request.GET:
                try:
                    n = TruthKeyValue.objects.get(id=key_value_id)
                    n.delete()
                    resp = rc.ALL_OK
                    resp.write('json = {"id":"%s"}' % str(key_value_id))
                except:
                    resp = rc.NOT_FOUND
                return resp
        
        resp = rc.ALL_OK
        resp.write('json = {"id":"1"}')
        return resp
dataset/ETHPy150Open mozilla/inventory/api_v2/keyvalue_handler.py/KeyValueHandler.delete/original