def shared_task(constructor):
    """Decorator that specifies a function that generates a built-in task.
    The function will then be called for every new app instance created
    (lazily, so more exactly when the task registry for that app is needed).
    The function must take a single ``app`` argument.
    """
_shared_tasks.add(constructor)
return constructor
How to use the @shared_task decorator for class based tasks