def defers(func):
    """Decorator to make sure a function always returns a deferred"""
    @wraps(func)
    def wrapped(*a, **kw):
        return defer.maybeDeferred(func, *a, **kw)
    return wrapped
Decorator to make sure a function always returns a deferred
stackoverflow/venv/lib/python3.6/site-packages/scrapy/utils/decorators.py