<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):
 """Stop watching the socket."""

        if self.closed:
            raise ConnectionClosed()

        if self.read_watcher.active:
            self.read_watcher.stop()
        if self.write_watcher.active:
            self.write_watcher.stop()