code: def when_closed(self):
          
          if self.state in ['CLOSED', 'FAILED']:
              return defer.succeed(self)
          return self._when_closed.when_fired()
docs: Returns a Deferred that callback()'s (with this Circuit instance)
          when this circuit hits CLOSED or FAILED.