<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def transform_doc_comments(text):
 """ Parse XML content for references and other syntax. This avoids an LXML dependency, we only need to parse out a small subset of elements here. Iterate over string to reduce regex pattern complexity and make substitutions easier .. seealso:: `Doc comment reference <https://msdn.microsoft.com/en-us/library/5ast78ax.aspx>` Reference on XML documentation comment syntax """

        try:
            while True:
                found = DOC_COMMENT_SEE_PATTERN.search(text)
                if found is None:
                    break
                ref = found.group("attr_value").replace("<", "\<").replace("`", "\`")

                reftype = "any"
                replacement = ""
                # Given the pattern of `\w:\w+`, inspect first letter of
                # reference for identity type
                if ref[1] == ":" and ref[0] in DOC_COMMENT_IDENTITIES:
                    reftype = DOC_COMMENT_IDENTITIES[ref[:1]]
                    ref = ref[2:]
                    replacement = ":{reftype}:`{ref}`".format(reftype=reftype, ref=ref)
                elif ref[:2] == "!:":
                    replacement = ref[2:]
                else:
                    replacement = ":any:`{ref}`".format(ref=ref)

                # Escape following text
                text_end = text[found.end() :]
                text_start = text[: found.start()]
                text_end = re.sub(r"^(\S)", r"\\\1", text_end)
                text_start = re.sub(r"(\S)$", r"\1 ", text_start)

                text = "".join([text_start, replacement, text_end])
            while True:
                found = DOC_COMMENT_PARAM_PATTERN.search(text)
                if found is None:
                    break

                # Escape following text
                text_end = text[found.end() :]
                text_start = text[: found.start()]
                text_end = re.sub(r"^(\S)", r"\\\1", text_end)
                text_start = re.sub(r"(\S)$", r"\1 ", text_start)

                text = "".join(
                    [text_start, "``", found.group("attr_value"), "``", text_end]
                )
        except TypeError:
            pass
        return text