'Closes the socket.'

def close(self):

    self.acquire()
    try:
        sock = self.sock
        if sock:
            self.sock = None
            sock.close()
    finally:
        self.release()
    logging.Handler.close(self)
