def parse_version(version):
global parse_version<EOL>try:<EOL><INDENT>from pkg_resources import parse_version<EOL><DEDENT>except ImportError:<EOL><INDENT>from distutils.version import LooseVersion as parse_version<EOL><DEDENT>return parse_version(version)<EOL>
Use parse_version from pkg_resources or distutils as available.