code: def find_version_to_install(self, name):
          
          version = Version.parse(name)
          if version.patch is not None:
              return name
          try:
              best_match = max((
                  inst_version
                  for inst_version in self.iter_installable_versions()
                  if inst_version.matches_minor(version)
              ), key=operator.attrgetter('cmpkey'))
          except ValueError:
              raise ValueError(
                  'no installable version found for {0!r}'.format(name),
              )
          return best_match
docs: Find a version in pyenv from the version supplied.
  
          A ValueError is raised if a matching version cannot be found.