Check condition before method call
<p>I have a class named Server which can be started and stopped. Certain methods should not be called unless the Server is started, in which case a NotConnectedException should be raised. Is there a way to call a method before every method in a class and determine if class variable _started is set to True?</p>

<p>I tried using a decorator, but the decorator function does not have access to the class variable. I was trying to do something like this:</p>

<pre><code>class Server(object):
    _started = False
    def started(self):
        if(self._started == False):
            raise NotConnectedException

    @started
    def doServerAction(self):
       ...
</code></pre>
