docstr: Parses `version` option value.
  
  :param value:
  :rtype: str
docstr_tok: ["Parses","`","version","`","option","value",".",":","param","value",":",":","rtype",":","str"]
code: def _parse_version(self, value):
      """Parses `version` option value.
  
      :param value:
      :rtype: str
  
      """
      version = self._parse_file(value)
  
      if version != value:
          version = version.strip()
          # Be strict about versions loaded from file because it's easy to
          # accidentally include newlines and other unintended content
          if isinstance(parse(version), LegacyVersion):
              tmpl = (
                  "Version loaded from {value} does not "
                  "comply with PEP 440: {version}"
              )
              raise DistutilsOptionError(tmpl.format(**locals()))
  
          return version
  
      version = self._parse_attr(value, self.package_dir)
  
      if callable(version):
          version = version()
  
      if not isinstance(version, string_types):
          if hasattr(version, "__iter__"):
              version = ".".join(map(str, version))
          else:
              version = "%s" % version
  
      return version
  
imports: from __future__ import absolute_import, unicode_literals
  import io
  import os
  import sys
  import warnings
  import functools
  from collections import defaultdict
  from functools import partial
  from functools import wraps
  from importlib import import_module
  from distutils.errors import DistutilsOptionError, DistutilsFileError
  from setuptools.extern.packaging.version import LegacyVersion, parse
  from setuptools.extern.packaging.specifiers import SpecifierSet
  from setuptools.extern.six import string_types, PY3
label_desc: Use image node_id 3 for calling the ConfigMetadataHandler obj's underlying member method code with example usage: obj._parse_version(value) and returns: version, version