title: Does a generator decorator exist?
body: <p>I just got through tracking down a random bug while using Twisted:</p>
  
  <pre><code>Traceback (most recent call last):
    File "/usr/lib/python2.7/dist-packages/twisted/spread/pb.py", line 826, in proto_message
      self._recvMessage(self.localObjectForID, requestID, objectID, message, answerRequired, netArgs, netKw)
    File "/usr/lib/python2.7/dist-packages/twisted/spread/pb.py", line 840, in _recvMessage
      netResult = object.remoteMessageReceived(self, message, netArgs, netKw)
    File "/usr/lib/python2.7/dist-packages/twisted/spread/flavors.py", line 114, in remoteMessageReceived
      state = method(*args, **kw)
    File "/usr/lib/python2.7/dist-packages/twisted/internet/defer.py", line 1141, in unwindGenerator
      return _inlineCallbacks(None, f(*args, **kwargs), Deferred())
  --- &lt;exception caught here&gt; ---
    File "/usr/lib/python2.7/dist-packages/twisted/internet/defer.py", line 1020, in _inlineCallbacks
      result = g.send(result)
  exceptions.AttributeError: 'NoneType' object has no attribute 'send'
  </code></pre>
  
  <p>This was caused by:</p>
  
  <pre><code>@defer.inlineCallbacks
  def myfunc():
      # Function implementation with no yield statement.
  </code></pre>
  
  <p>And when the <code>myfunc</code> was called, I would get the previous traceback printed but with everything within the function working properly. This is because it returned <code>None</code> instead a generator when called, which <code>defer.inlineCallbacks</code> expects to be returned. Is there way to declare a function a generator without placing a yield statement within the function body? Such as a generator decorator?</p>