import hashlib


def is_proof_valid(last_proof, proof, last_hash):
    """
    Validates the Proof

    :param last_proof: <int> Previous Proof
    :param proof: <int> Current Proof
    :param last_hash: <str> The hash of the Previous Block
    :return: <bool> True if correct, False if not.

    """

    guess = f'{last_proof}{proof}{last_hash}'.encode()
    guess_hash = hashlib.sha256(guess).hexdigest()

    """print('\n')
    print('last_proof:', last_proof)
    print('proof:', proof)
    print('last_hash:', last_hash)
    print('guess:', f'{last_proof}{proof}{last_hash}')
    print('encoded_guess:', guess)
    print('hashed_guess:', guess_hash)"""

    return guess_hash[:4] == "0000"