def METHOD_NAME(gst_accounts, voucher_type, error_voucher_types):
    doc = frappe.qb.DocType(voucher_type)
    gl_doc = frappe.qb.DocType("GL Entry")
    try:
        return (
            frappe.qb.from_(gl_doc)
            .join(doc)
            .on((gl_doc.voucher_no == doc.name) & (gl_doc.voucher_type == voucher_type))
            .where(gl_doc.account.isin(gst_accounts))
            .where(gl_doc.company_gstin.isnull() | (gl_doc.company_gstin == ""))
            .where(doc.company_gstin.notnull() & (doc.company_gstin != ""))
            .select(gl_doc.name, doc.company_gstin)
            .limit(100000)
            .run(as_dict=True)
        )
    except Exception:
        error_voucher_types.add(voucher_type)