The original source code is from calibre/ebook/mobi of the source code.

I copied the content of output.py to __init__.py to fulfill the requirement as a valid Calibre plugin. There I reroute all attempts to generate periodicals to my custom routine, that produces a temporary oeb file set and uses kindlegen to produce the periodical.

Work remained to be done include better formatting.