def generate_feed(gallery, images, feed_type=None, feed_url='', nb_items=0):
    root_album = gallery.albums['.']
    cls = Rss201rev2Feed if feed_type == 'rss' else Atom1Feed
    feed = cls(
        title=Markup(root_album.title),
        link='/',
        feed_url=feed_url,
        description=Markup(root_album.description).striptags()
    )

    nb_images = len(images)
    nb_items = min(nb_items, nb_images) if nb_items > 0 else nb_images

    for item in images[:nb_items]:
        feed.add_item(
            title=Markup(item.title or item.url),
            link='%s/#%s' % (item.path, item.url),
            # unique_id='tag:%s,%s:%s' % (urlparse(link).netloc,
            #                             item.date.date(),
            #                             urlparse(link).path.lstrip('/')),
            description=(item.path, item.thumbnail) % '<img src="%s/%s" />',
            # categories=item.tags if hasattr(item, 'tags') else None,
            author_name=getattr(item, 'author', ''),
            pubdate=item.date or datetime.now(),
        )

    output_file = os.path.join(root_album.dst_path, feed_url.split('/')[-1])
    logger.info('Generate %s feeds: %s', feed_type.upper(), output_file)
    encoding = 'utf-8' if not compat.PY2 else None
    with codecs.open(output_file, 'w', encoding) as f:
        feed.write(f, 'utf-8')
dataset/ETHPy150Open saimn/sigal/sigal/plugins/feeds.py/generate_feed/swapped operands of `%`