import hashlib


def generate_sha256_hash(filename):
    """"
    Generates a sha256 hash of a file.
    :param: filename
    :return: sha256_hash
    """
    sha256_hash = hashlib.sha256()
    with open(filename, "rb") as f:
        # Read and update hash string value in blocks of 4K.
        for byte_block in iter(lambda: f.read(4096), b""):
            sha256_hash.update(byte_block)
        sha256_hash = sha256_hash.hexdigest()
    return sha256_hash