def get_share_name(doctype, name, user, everyone): if cint(everyone): share_name = frappe.db.get_value("DocShare", {"everyone": 1, "share_name": name, "share_doctype": doctype}) else: share_name = frappe.db.get_value("DocShare", {"user": user, "share_name": name, "share_doctype": doctype}) return share_name