def find_expectation(self, key: DeviceProperties = (None, None)) -> Any:
        """
        Find best matching expectation based on provided device properties.
        """
        (result_key, result) = max(self.data.items(), key=lambda x: Expectations.score(key, x[0]))

        if Expectations.score(key, result_key) == 0:
            raise ValueError(f"No matching expectation found for {key}")

        return result

        Find best matching expectation based on provided device properties.
        
src/diffusers/utils/testing_utils.py