def py_str2float(version):
if version.endswith('<STR_LIT>'):<EOL><INDENT>version = version[:-len('<STR_LIT>')]<EOL><DEDENT>if version in magics:<EOL><INDENT>magic = magics[version]<EOL>for v, m in list(magics.items()):<EOL><INDENT>if m == magic:<EOL><INDENT>try:<EOL><INDENT>return float(canonic_python_version[v])<EOL><DEDENT>except:<EOL><INDENT>try:<EOL><INDENT>m = re.match(r'<STR_LIT>', v)<EOL>if m:<EOL><INDENT>return float(m.group(<NUM_LIT:1>)+m.group(<NUM_LIT:2>))<EOL><DEDENT><DEDENT>except:<EOL><INDENT>pass<EOL><DEDENT>pass<EOL><DEDENT>pass<EOL><DEDENT>pass<EOL><DEDENT><DEDENT>raise RuntimeError("<STR_LIT>"<EOL>% version)<EOL>return<EOL>
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.