def settimeout(self, timeout):
    prev = self.sock.gettimeout()
    self.sock.settimeout(timeout)
    return prev
def settimeout(self, timeout):
    prev = self.sock.gettimeout()
    self.sock.settimeout(timeout)
    return prev