def safe_version(version):
try:<EOL><INDENT>return str(packaging.version.Version(version))<EOL><DEDENT>except packaging.version.InvalidVersion:<EOL><INDENT>version = version.replace('<STR_LIT:U+0020>', '<STR_LIT:.>')<EOL>return re.sub('<STR_LIT>', '<STR_LIT:->', version)<EOL><DEDENT>
Convert an arbitrary string to a standard version string