def create_cbz(directory):
    """Creates or updates a CBZ from files in the given comic directory."""
    if not os.path.isdir(directory):
        print("ERROR: Directory", directory, "not found.")
        return
    base = os.path.basename(directory.rstrip(os.path.sep))
    zipname = '%s.cbz' % base
    zipname = os.path.join(directory, zipname)
    d = os.path.join(directory, 'inorder')
    if os.path.isdir(d):
        # use directory with ordered symlinks
        directory = d
    if os.path.exists(zipname):
        os.remove(zipname)
    with zipfile.ZipFile(zipname, 'w') as myzip:
        for filename in sorted(os.listdir(d)):
            fullname = os.path.join(d, filename)
            if is_image(fullname):
                myzip.write(fullname)
        myzip.comment = get_cbz_comment()
    print("INFO: Created", zipname)