code: def py_str2float(version):
      
      if version.endswith('pypy'):
          version = version[:-len('pypy')]
      if version in magics:
          magic = magics[version]
          for v, m in list(magics.items()):
              if m == magic:
                  try:
                      return float(canonic_python_version[v])
                  except:
                      try:
                          m = re.match(r'^(\d\.)(\d+)\.(\d+)$', v)
                          if m:
                              return float(m.group(1)+m.group(2))
                      except:
                          pass
                      pass
                  pass
              pass
      raise RuntimeError("Can't find a valid Python version for version %s"
                         % version)
      return
docs: Convert a Python version into a two-digit 'canonic' floating-point number,
      e.g. 2.5, 3.6.
  
      A runtime error is raised if "version" is not found.
  
      Note that there can be several strings that map to a single floating-
      point number. For example 3.2a1, 3.2.0, 3.2.2, 3.2.6 among others all map to
      3.2.