docs: def parse_python(spec):  # Ignore PyDocStyleBear
          """Parse PyPI specification of a single dependency.
  
          :param spec: str, for example "Django>=1.5,<1.8"
          :return: [Django [[('>=', '1.5'), ('<', '1.8')]]]
          """
  
          def _extract_op_version(spec):
              # https://www.python.org/dev/peps/pep-0440/#compatible-release
              if spec.operator == "~=":
                  version = spec.version.split(".")
                  if len(version) in {2, 3, 4}:
                      if len(version) in {3, 4}:
                          del version[-1]  # will increase the last but one in next line
                      version[-1] = str(int(version[-1]) + 1)
                  else:
                      raise ValueError("%r must not be used with %r" % (spec.operator, spec.version))
                  return [(">=", spec.version), ("<", ".".join(version))]
              # Trailing .* is permitted per
              # https://www.python.org/dev/peps/pep-0440/#version-matching
              elif spec.operator == "==" and spec.version.endswith(".*"):
                  try:
                      result = check_output(["/usr/bin/semver-ranger", spec.version], universal_newlines=True).strip()
                      gte, lt = result.split()
                      return [(">=", gte.lstrip(">=")), ("<", lt.lstrip("<"))]
                  except ValueError:
                      _LOGGER.warning("couldn't resolve ==%s", spec.version)
                      return spec.operator, spec.version
              # https://www.python.org/dev/peps/pep-0440/#arbitrary-equality
              # Use of this operator is heavily discouraged, so just convert it to 'Version matching'
              elif spec.operator == "===":
                  return "==", spec.version
              else:
                  return spec.operator, spec.version
  
          def _get_pip_spec(requirements):
              """There is no `specs` field In Pip 8+, take info from `specifier` field."""
              if hasattr(requirements, "specs"):
                  return requirements.specs
              elif hasattr(requirements, "specifier"):
                  specs = [_extract_op_version(spec) for spec in requirements.specifier]
                  if len(specs) == 0:
                      # TODO: I'm not sure with this one
                      # we should probably return None instead and let pip deal with this
                      specs = [(">=", "0.0.0")]
                  return specs
  
          _LOGGER.info("Parsing dependency %r", spec)
          # create a temporary file and store the spec there since
          # `parse_requirements` requires a file
          with NamedTemporaryFile(mode="w+", suffix="pysolve") as f:
              f.write(spec)
              f.flush()
              parsed = parse_requirements(f.name, session=f.name)
              dependency = [Dependency(x.name, _get_pip_spec(x.req)) for x in parsed].pop()
  
          return dependency