<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def stop(self):
 """disconnect, blocks until stopped """

        self.__end.set()
        if self.__recv_thread:
            self.__recv_thread.join()
            self.__recv_thread = None
        if self.__send_thread:
            self.__send_thread.join()
            self.__send_thread = None