def METHOD_NAME(query, on):
    "Create update or delete the query compliance check"
    created = updated = deleted = False
    if on:
        if not isinstance(query.version, int):
            query.refresh_from_db()
        cc_defaults = {
            "model": OsqueryCheck.get_model(),
            "name": query.name,
            "version": query.version,
            "description": query.description
        }
        if not query.compliance_check:
            query.compliance_check = ComplianceCheck.objects.create(**cc_defaults)
            query.save()
            created = True
        else:
            for key, val in cc_defaults.items():
                if getattr(query.compliance_check, key) != val:
                    setattr(query.compliance_check, key, val)
                    updated = True
            if updated:
                query.compliance_check.save()
    elif query.compliance_check:
        query.compliance_check.delete()
        deleted = True
    return created, updated, deleted