code: def _docf(self, tag, val):
          
          if tag == 'type':
              fq_val = val
              if '.' not in val:
                  fq_val = self.cur_namespace.name + '.' + fq_val
              return ':class:`{}.{}`'.format(self.args.types_package, fq_val)
          elif tag == 'route':
              if ':' in val:
                  val, version = val.split(':', 1)
                  version = int(version)
              else:
                  version = 1
              if '.' in val:
                  return ':meth:`{}`'.format(fmt_func(val, version=version))
              else:
                  return ':meth:`{}_{}`'.format(
                      self.cur_namespace.name, fmt_func(val, version=version))
          elif tag == 'link':
              anchor, link = val.rsplit(' ', 1)
              return '`{} <{}>`_'.format(anchor, link)
          elif tag == 'val':
              if val == 'null':
                  return 'None'
              elif val == 'true' or val == 'false':
                  return '``{}``'.format(val.capitalize())
              else:
                  return val
          elif tag == 'field':
              return '``{}``'.format(val)
          else:
              raise RuntimeError('Unknown doc ref tag %r' % tag)
docs: Callback used as the handler argument to process_docs(). This converts
          Babel doc references to Sphinx-friendly annotations.