def METHOD_NAME(doc_id):
    if xform_dict['doc_type'] in [
            "XFormInstance",
            "XFormArchived",
            "XFormError",
            "XFormDeprecated"]:
        view_name = 'render_form_data'
    else:
        view_name = 'download_form'
    try:
        return format_html(
            "<a class='ajax_dialog' href='{url}'>{text}</a>",
            url=reverse(view_name, args=[self.domain, doc_id]),
            text=_("View Form")
        )
    except NoReverseMatch:
        return 'unable to view form'