def METHOD_NAME(reference_doctype, reference_name):
	prospect = None
	if reference_doctype == "Lead":
		prospect = frappe.db.get_value("Prospect Lead", {"lead": reference_name}, "parent")
	elif reference_doctype == "Opportunity":
		opportunity_from, party_name = frappe.db.get_value(
			"Opportunity", reference_name, ["opportunity_from", "party_name"]
		)
		if opportunity_from == "Lead":
			prospect = frappe.db.get_value(
				"Prospect Opportunity", {"opportunity": reference_name}, "parent"
			)
		if opportunity_from == "Prospect":
			prospect = party_name
	return prospect