def _fireWhenDoneFunc(self, d, f):
        """Returns closure that when called calls f and then callbacks d.
        """
        @wraps(f)
        def newf(*args, **kw):
            rtn = f(*args, **kw)
            d.callback('')
            return rtn
        return newf
Returns closure that when called calls f and then callbacks d.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_tcp.py