'Stop running function.'

def stop(self):

    assert self.running, 'Tried    to    stop    a    LoopingCall    that    was    not    running.'
    self.running = False
    if (self.call is not None):
        self.call.cancel()
        self.call = None
        (d, self._deferred) = (self._deferred, None)
        d.callback(self)
