import frappe def get_company(): company = frappe.defaults.get_defaults().company if company: return company else: company = frappe.get_list("Company", limit=1) if company: return company[0].name return None