'Get either the passed-in reactor or the global reactor.'

def _getReactor(self):

    if (self.reactor is not None):
        reactor = self.reactor
    else:
        from twisted.internet import reactor
    return reactor
