def METHOD_NAME(self, pulling_done):
    """Pull data from TCP connection."""
    logging.getLogger("moler_threads").debug("ENTER {}".format(self))
    heartbeat = tracked_thread.report_alive()
    while not pulling_done.is_set():
        if next(heartbeat):
            logging.getLogger("moler_threads").debug("ALIVE {}".format(self))
        try:
            data = self.receive(timeout=0.1)
            if data:
                # make Moler happy :-)
                self.moler_connection.data_received(data, datetime.datetime.now())  # (3)
        except ConnectionTimeout:
            continue
        except RemoteEndpointNotConnected:
            break
        except RemoteEndpointDisconnected:
            break
    if self.socket is not None:
        self._close_ignoring_exceptions()
    logging.getLogger("moler_threads").debug("EXIT  {}".format(self))