'Set a timeout.
This will cancel any existing timeouts.
@param timeoutPeriod: If not L{None}, change the timeout period.
Otherwise, use the existing value.'

def setTimeout(self, timeoutPeriod=None):

    self.cancelTimeout()
    if (timeoutPeriod is not None):
        self.timeoutPeriod = timeoutPeriod
    self.timeoutCall = self.factory.callLater(self.timeoutPeriod, self.timeoutFunc)
