def scrub_field_names(self):
		restricted = ('name','parent','creation','modified','modified_by',
			'parentfield','parenttype',"file_list")
		for d in self.get("fields"):
			if d.fieldtype:
				if (not getattr(d, "fieldname", None)):
					if d.label:
						d.fieldname = d.label.strip().lower().replace(' ','_')
						if d.fieldname in restricted:
							d.fieldname = d.fieldname + '1'
					else:
						d.fieldname = d.fieldtype.lower().replace(" ","_") + "_" + str(d.idx)

				# fieldnames should be lowercase
				d.fieldname = d.fieldname.lower()
Sluggify fieldnames if not set from Label.
dataset/ETHPy150Open frappe/frappe/frappe/core/doctype/doctype/doctype.py/DocType.scrub_field_names