def METHOD_NAME(
    block_number: int, mining_hash: Hash32, difficulty: int
) -> Tuple[bytes, bytes]:
    cache = get_cache(block_number)
    for nonce in range(MAX_TEST_MINE_ATTEMPTS):
        mining_output = hashimoto_light(block_number, cache, mining_hash, nonce)
        result = big_endian_to_int(mining_output[b"result"])
        result_cap = 2**256 // difficulty
        if result <= result_cap:
            return nonce.to_bytes(8, "big"), mining_output[b"mix digest"]
    raise Exception("Too many attempts at POW mining, giving up")