def METHOD_NAME(self, gstin, service, require_password=True):
    for row in self.settings.credentials:
        if row.gstin == gstin and row.service == service:
            break
    else:
        frappe.throw(
            _(
                "Please set the relevant credentials in GST Settings to use the"
                " {0} API"
            ).format(self.API_NAME),
            frappe.DoesNotExistError,
            title=_("Credentials Unavailable"),
        )
    self.username = row.username
    self.company = row.company
    self.password = row.get_password(raise_exception=require_password)