import hashlib


def sha256sum(file: str) -> str:
    """
    Returns the sha256 sum of a file

    :param file: (str) path to file
    :return: (str) checksum
    """
    sha256 = hashlib.sha256()

    try:
        with open(file, "rb") as file_handle:
            while True:
                data = file_handle.read(65536)
                if not data:
                    break
                sha256.update(data)
        return sha256.hexdigest()
    except IOError:
        raise IOError('Cannot create SHA256 sum for file "%s"' % file) from IOError