def set_permission(key, readable, writeable, modifiable, token=''):
    try:
        res = resource_permission.objects.get(key=key)
        res.delete()
        raise Exception()
    except:
        resource_permission.objects.create(key=key, readable=readable, writeable=writeable, modifiable=modifiable, token=token)
def set_permission(key, readable, writeable, modifiable, token=):
    try:
        res = resource_permission.objects.get(key=key)
        res.delete()
        raise Exception()
    except:
        resource_permission.objects.create(key=key, readable=readable, writeable=writeable, modifiable=modifiable, token=token)