import hashlib


def check_sum(fl_name, tid=None):
    """
    compute checksum for generated file of `fl_name`
    """
    hasher = hashlib.md5()
    with open(fl_name, 'rb') as fin:
        for chunk in iter(lambda: fin.read(4096), b""):
            hasher.update(chunk)
    ret = hasher.hexdigest()
    if tid is not None:
        ret = ret + str(tid)
    return ret