def validate_value(self, fieldname, condition, val2, doc=None, raise_exception=None):
		error_condition_map = {
			"in": _("one of"),
			"not in": _("none of"),
			"^": _("beginning with"),
		}

		if not doc:
			doc = self

		val1 = doc.get_value(fieldname)

		df = doc.meta.get_field(fieldname)
		val2 = doc.cast(val2, df)

		if not frappe.compare(val1, condition, val2):
			label = doc.meta.get_label(fieldname)
			condition_str = error_condition_map.get(condition, condition)
			if doc.parentfield:
				msg = _("Incorrect value in row {0}: {1} must be {2} {3}".format(doc.idx, label, condition_str, val2))
			else:
				msg = _("Incorrect value: {0} must be {1} {2}".format(label, condition_str, val2))

			# raise passed exception or True
			msgprint(msg, raise_exception=raise_exception or True)
Clone with COW.
dataset/ETHPy150Open frappe/frappe/frappe/model/document.py/Document.validate_value--crossover with--dataset/ETHPy150Open F-Secure/see/see/context/resources/test/qemu_test.py/DiskCloneTest.test_clone_cow