def METHOD_NAME(gl_entries_by_account, accounts_by_name, dimension_list, dimension_type):
	for entries in gl_entries_by_account.values():
		for entry in entries:
			d = accounts_by_name.get(entry.account)
			if not d:
				frappe.msgprint(
					_("Could not retrieve information for {0}.").format(entry.account),
					title="Error",
					raise_exception=1,
				)
			for dimension in dimension_list:
				if dimension == entry.get(dimension_type):
					d[frappe.scrub(dimension)] = (
						d.get(frappe.scrub(dimension), 0.0) + flt(entry.debit) - flt(entry.credit)
					)