How to display a docstring in UI with flask?

I am importing a python script into my flask web app as such

   def register_tasks_in_db():
    from haz import tasks as hz

    tasks = {f'{modname}': importlib.import_module(
        f'haz.tasks.{modname}') for importer, modname, ispkg in
        pkgutil.iter_modules(hz.__path__)}

    with app.app_context():
        stored_tasks = Task.query.all()

        for stored_task in stored_tasks:
           if stored_task.name in tasks.keys():
                _ = tasks.pop(stored_task.name)
                current_app.logger.info(f'{stored_task.name} 
already exists in db')

        for name, obj in tasks.items():
            tasks = Task(name=name)
            tasks.save()


app = create_app()
app.secret_key = app.config['SECRET_KEY']
worker = create_celery_app(app) # a Celery object
register_tasks_in_db()


@app.shell_context_processor
def make_shell_context():
    return {'db': db, 'User': User, 'Institution': Institution,
            'Image': Image, 'Series': Series, 'Study': Study, 
'Device': Device,
            'Task': Task, 'Report': Report}


if __name__ == "__main__":
    app.run(host='0.0.0.0', port=int(os.getenv('PORT', 5001)))

Each of this tasks contains a docstring. How do I access and display the dosctring in the UI?

I thought I would need to do something like: print(doc)

here

 for name, obj in tasks.items():
            tasks = Task(name=name)
            doc=print(__doc__)
            tasks.save()

and then

        'Device': Device,
            'Task': Task, 'Report': Report, 'doc': doc}
Back to Top