Find the python version which corresponds most closely to the version requested.

        :param Union[str, int] major: The major version to look for, or the full version, or the name of the target version.
        :param Optional[int] minor: The minor version. If provided, disables string-based lookups from the major version field.
        :param Optional[int] patch: The patch version.
        :param Optional[bool] pre: If provided, specifies whether to search pre-releases.
        :param Optional[bool] dev: If provided, whether to search dev-releases.
        :param Optional[str] arch: If provided, which architecture to search.
        :param Optional[str] name: *Name* of the target python, e.g. ``anaconda3-5.3.0``
        :return: A new *PathEntry* pointer at a matching python version, if one can be located.
        :rtype: :class:`pythonfinder.models.path.PathEntry`

def find_python_version(
        self, major=None, minor=None, patch=None, pre=None, dev=None, arch=None, name=None
    ):
        # type: (Optional[Union[str, int]], Optional[int], Optional[int], Optional[bool], Optional[bool], Optional[str], Optional[str]) -> PathEntry
        """
        Find the python version which corresponds most closely to the version requested.

        :param Union[str, int] major: The major version to look for, or the full version, or the name of the target version.
        :param Optional[int] minor: The minor version. If provided, disables string-based lookups from the major version field.
        :param Optional[int] patch: The patch version.
        :param Optional[bool] pre: If provided, specifies whether to search pre-releases.
        :param Optional[bool] dev: If provided, whether to search dev-releases.
        :param Optional[str] arch: If provided, which architecture to search.
        :param Optional[str] name: *Name* of the target python, e.g. ``anaconda3-5.3.0``
        :return: A new *PathEntry* pointer at a matching python version, if one can be located.
        :rtype: :class:`pythonfinder.models.path.PathEntry`
        """

        from .models import PythonVersion

        minor = int(minor) if minor is not None else minor
        patch = int(patch) if patch is not None else patch

        version_dict = {
            "minor": minor,
            "patch": patch,
        }  # type: Dict[str, Union[str, int, Any]]

        if (
            isinstance(major, six.string_types)
            and pre is None
            and minor is None
            and dev is None
            and patch is None
        ):
            if arch is None and "-" in major and major[0].isdigit():
                orig_string = "{0!s}".format(major)
                major, _, arch = major.rpartition("-")
                if arch.startswith("x"):
                    arch = arch.lstrip("x")
                if arch.lower().endswith("bit"):
                    arch = arch.lower().replace("bit", "")
                if not (arch.isdigit() and (int(arch) & int(arch) - 1) == 0):
                    major = orig_string
                    arch = None
                else:
                    arch = "{0}bit".format(arch)
                try:
                    version_dict = PythonVersion.parse(major)
                except (ValueError, InvalidPythonVersion):
                    if name is None:
                        name = "{0!s}".format(major)
                        major = None
                    version_dict = {}
            elif major[0].isalpha():
                name = "%s" % major
                major = None
            else:
                if "." in major and all(part.isdigit() for part in major.split(".")[:2]):
                    match = version_re.match(major)
                    version_dict = match.groupdict()
                    version_dict["is_prerelease"] = bool(
                        version_dict.get("prerel", False)
                    )
                    version_dict["is_devrelease"] = bool(version_dict.get("dev", False))
                else:
                    version_dict = {
                        "major": major,
                        "minor": minor,
                        "patch": patch,
                        "pre": pre,
                        "dev": dev,
                        "arch": arch,
                    }
            if version_dict.get("minor") is not None:
                minor = int(version_dict["minor"])
            if version_dict.get("patch") is not None:
                patch = int(version_dict["patch"])
            if version_dict.get("major") is not None:
                major = int(version_dict["major"])
            _pre = version_dict.get("is_prerelease", pre)
            pre = bool(_pre) if _pre is not None else pre
            _dev = version_dict.get("is_devrelease", dev)
            dev = bool(_dev) if _dev is not None else dev
            arch = (
                version_dict.get("architecture", None) if arch is None else arch
            )  # type: ignore
        if os.name == "nt" and self.windows_finder is not None:
            match = self.windows_finder.find_python_version(
                major=major,
                minor=minor,
                patch=patch,
                pre=pre,
                dev=dev,
                arch=arch,
                name=name,
            )
            if match:
                return match
        return self.system_path.find_python_version(
            major=major, minor=minor, patch=patch, pre=pre, dev=dev, arch=arch, name=name
        )