def escape(self, s, percent=True):
		if isinstance(s, unicode):
			s = (s or "").encode("utf-8")

		s = unicode(MySQLdb.escape_string(s), "utf-8").replace("`", "\\`")

		# NOTE separating % escape, because % escape should only be done when using LIKE operator
		# or when you use python format string to generate query that already has a %s
		# for example: sql("select name from `tabUser` where name=%s and {0}".format(conditions), something)
		# defaulting it to True, as this is the most frequent use case
		# ideally we shouldn't have to use ESCAPE and strive to pass values via the values argument of sql
		if percent:
			s = s.replace("%", "%%")

		return s
Creates space for a new tree by incrementing all tree ids
dataset/ETHPy150Open frappe/frappe/frappe/database.py/Database.escape--crossover with--dataset/ETHPy150Open django-mptt/django-mptt/mptt/managers.py/TreeManager._create_tree_space