def create(self, request, key_value_id=None):
        if 'system_id' in request.POST:
            post_key = request.POST.get('key')
            post_value = request.POST.get('value')
            system_id = request.POST.get('system_id')
            n = KeyValue()
            system = System.objects.get(id=system_id)
            if re.search('^nic\.(\d+)\.ipv4_address', str(post_key).strip() ):
                try:
                    acl = KeyValueACL(request)
                    acl.check_ip_not_exist_other_system(system, post_value)
                except Exception, e:
                    resp = rc.FORBIDDEN
                    resp.write(e)
                    return resp
            try:
                n.obj = system
                if 'key' in request.POST:
                    n.key = request.POST['key']
                if 'value' in request.POST:
                    n.value = request.POST['value']
                n.save()
                resp = rc.ALL_OK
                resp.write('json = {"id":%i}' % (n.id))
            except:
                resp = rc.NOT_FOUND
                resp.write('Unable to Create Key/Value Pair')
            return resp
        elif 'truth_name' in request.POST:
            n = TruthKeyValue()
            truth = Truth.objects.get(name=request.POST['truth_name'])
            n.truth = truth
            if 'key' in request.POST:
                n.key = request.POST['key']
            if request.POST in 'value':
                n.value = request.POST['value']
            try:
                n.save()
                resp = rc.ALL_OK
                resp.write('json = {"id":%i}' % (n.id))
            except:
                resp = rc.NOT_FOUND
                resp.write('Unable to Create Key/Value Pair')
            return resp
        else:
            resp = rc.NOT_FOUND
            resp.write('system_id or truth_name required')
dataset/ETHPy150Open mozilla/inventory/api_v2/keyvalue_handler.py/KeyValueHandler.create/swapped operands of `in`