def _release_matches_py_version(self, pkg_data, release):
        """
        Check if a release is compatible with the python version.
        :param pkg_data: package information
        :type pkg_data: dict
        :param release: the release to check
        :type release: str
        :return: whether the releases matches the python version
        :rtype: boolean
        """
        had_v = False
        has_source = False
        downloads = self._package_downloads(pkg_data, release)
        for download in downloads:
            requires_python = download.get("requires_python", None)
            if requires_python is not None:
                reqs = "python" + requires_python
                name, ver_spec, extras = VersionSpecifier.parse_requirement(reqs)
                assert name == "python"  # if this if False some large bug happened...
                if ver_spec.match(platform.python_version()):
                    # compatible
                    return True
            else:
                # fallback
                # TODO: do we require this?
                pv = download.get("python_version", None)
                if pv is None:
                    continue
                elif pv in ("py2.py3", "py3.py2"):
                    # compatible with both py versions
                    return True
                elif pv.startswith("2") or pv == "py2":
                    # py2 release
                    if not six.PY3:
                        return True
                elif pv.startswith("3") or pv == "py3":
                    # py3 release
                    if six.PY3:
                        return True
                elif pv == "source":
                    # i honestly have no idea what this means
                    # i first assumed it means "this source is compatible with both", so just return True
                    # however, this seems to be wrong. Instead, we use this as a fallback yes
                    has_source = True
            had_v = True
        if had_v:
            # no allowed downloads found
            return has_source
        else:
            # none found, maybe pypi changed
            # in this case, just return True
            # we did it before without these checks and it worked *most* of the time, so missing this check is not horrible...
            return True

        Check if a release is compatible with the python version.
        :param pkg_data: package information
        :type pkg_data: dict
        :param release: the release to check
        :type release: str
        :return: whether the releases matches the python version
        :rtype: boolean
        
bin/pip.py