def METHOD_NAME(doc):
	year_start_end_dates = frappe.db.sql(
		"""select name, year_start_date, year_end_date from `tabFiscal Year` where name!=%s""",
		(doc.name),
	)
	for fiscal_year, ysd, yed in year_start_end_dates:
		if (getdate(doc.year_start_date) == ysd and getdate(doc.year_end_date) == yed) and (
			not frappe.flags.in_test
		):
			frappe.throw(
				_("Fiscal Year Start Date and Fiscal Year End Date are already set in Fiscal Year {0}").format(
					fiscal_year
				)
			)