Migrated code from test page notebook to a real python package.