def is_hash_allowed(
        self,
        hash_name,   # type: str
        hex_digest,  # type: str
    ):
        # type: (...) -> bool
        """Return whether the given hex digest is allowed."""
        return hex_digest in self._allowed.get(hash_name, [])
Return whether the given hex digest is allowed.
product/gradle-plugin/src/main/python/pip/_internal/utils/hashes.py