parameters: (version)
docstring: Parse the given version string and return either a :class:`Version` object
      or a :class:`LegacyVersion` object depending on if the given version is
      a valid PEP 440 version or a legacy version.
docstring_summary: Parse the given version string and return either a :class:`Version` object
      or a :class:`LegacyVersion` object depending on if the given version is
      a valid PEP 440 version or a legacy version.
docstring_tokens: Parse the given version string and return either a : class : Version object or a : class : LegacyVersion object depending on if the given version is a valid PEP 440 version or a legacy version .
function: def parse(version):
      """
      Parse the given version string and return either a :class:`Version` object
      or a :class:`LegacyVersion` object depending on if the given version is
      a valid PEP 440 version or a legacy version.
      """
      try:
          return Version(version)
      except InvalidVersion:
          return LegacyVersion(version)
function_tokens: def parse ( version ) : try : return Version ( version ) except InvalidVersion : return LegacyVersion ( version )