code: def tf_role_fn(
      typ: str,
      rawtext: str,
      text: str,
      lineno: int,
      inliner: states.Inliner,
      options: Any = None,
      content: Any = None,
  ) -> Tuple[List[nodes.Node], List[nodes.system_message]]:
      """Generates a reference to a given TensorFlow API symbol.
  
      Only exported API symbols can be referenced. For example, non-exported
      :tf:`float32` will not produce a reference and will be rendered as
      plain-text.
  
      Args:
        typ: Type of the role. Fixed to ``"tf"``.
        rawtext: Raw contents of the role, e.g. ``":tf:`Module``"`.
        text: The `contents` of the role e.g. ``"Module"``.
        lineno: Line number of the parsed role.
        inliner: Inline reST markup parser. Used for error reporting.
        options: Unused.
        content: Unused.
  
      Returns:
        Generated reST nodes and system messages.
      """
      del options, content  # Unused.
  
      canonical_url = tf_doc_url(text)
      xref = nodes.literal(rawtext, typ + "." + text, classes=["xref"])
      if not canonical_url:
          warning = (
              "unable to expand :%s:`%s`; symbol is not exported by TensorFlow."
              % (typ, text)
          )
          inliner.reporter.warning(warning, line=lineno)
          return [xref], []
      else:
          node = nodes.reference(
              rawtext, "", xref, internal=False, refuri=canonical_url
          )
          return [node], []
  
file_path: sonnet/docs/ext/link_tf_api.py
imports: import functools
  from typing import Any, List, Tuple
  from urllib import parse
  from docutils import nodes
  from docutils.parsers.rst import states
  import tensorflow
  from tensorflow.python.util import tf_export
label_desc: Use image node_id 1 for calling a global function with example usage: tf_role_fn(typ, rawtext, text, lineno, inliner, options, content) and returns: list,  list, list,  list