def checksum(filepath, hash_prefix):
    """
    Check hash value of a file.

    Args:
        filepath (`str`): path of local file
        hash_prefix (`str`): prefix of hash value to compare with
    """
    with open(filepath, 'rb') as f:
        len_prefix = len(hash_prefix)
        data = f.read()
        if hashlib.sha256(data).hexdigest()[:len_prefix] == hash_prefix:
            return True
        elif hashlib.md5(data).hexdigest()[:len_prefix] == hash_prefix:
            return True
        else:
            return False
Check hash value of a file.

Args:
filepath (`str`): path of local file
hash_prefix (`str`): prefix of hash value to compare with
towhee/models/utils/download.py