code: def _get_anchor(module_to_name, fullname):
    
    if not _anchor_re.match(fullname):
      raise ValueError("'%s' is not a valid anchor" % fullname)
    anchor = fullname
    for module_name in module_to_name.values():
      if fullname.startswith(module_name + "."):
        rest = fullname[len(module_name)+1:]
        # Use this prefix iff it is longer than any found before
        if len(anchor) > len(rest):
          anchor = rest
    return anchor
docs: Turn a full member name into an anchor.
  
    Args:
      module_to_name: Dictionary mapping modules to short names.
      fullname: Fully qualified name of symbol.
  
    Returns:
      HTML anchor string.  The longest module name prefix of fullname is
      removed to make the anchor.
  
    Raises:
      ValueError: If fullname uses characters invalid in an anchor.