code: def tag_to_version(tag, config=None):
      
      trace("tag", tag)
  
      if not config:
          config = Configuration()
  
      tagdict = _parse_version_tag(tag, config)
      if not isinstance(tagdict, dict) or not tagdict.get("version", None):
          warnings.warn("tag %r no version found" % (tag,))
          return None
  
      version = tagdict["version"]
      trace("version pre parse", version)
  
      if tagdict.get("suffix", ""):
          warnings.warn(
              "tag %r will be stripped of its suffix '%s'" % (tag, tagdict["suffix"])
          )
  
      if VERSION_CLASS is not None:
          version = pkg_parse_version(version)
          trace("version", repr(version))
  
      return version
docs: take a tag that might be prefixed with a keyword and return only the version part
      :param config: optional configuration object