def writer(self, index, no_data_timeout=None):
is_fe_data_header = logical_and(is_fe_word, is_data_header)<EOL>logging.debug('<STR_LIT>', index)<EOL>self._data_conditions[index].acquire()<EOL>time_last_data = time()<EOL>time_write = time()<EOL>converted_data_tuple_list = [None] * len(self.filter_func)  <EOL>while True:<EOL><INDENT>try:<EOL><INDENT>if no_data_timeout and time_last_data + no_data_timeout < time():<EOL><INDENT>raise NoDataTimeout('<STR_LIT>' % (no_data_timeout, index))<EOL><DEDENT>converted_data_tuple = self._data_deque[index].popleft()<EOL><DEDENT>except NoDataTimeout:  <EOL><INDENT>no_data_timeout = None  <EOL>if self.errback:<EOL><INDENT>self.errback(sys.exc_info())<EOL><DEDENT>else:<EOL><INDENT>raise<EOL><DEDENT><DEDENT>except IndexError:  <EOL><INDENT>self._data_conditions[index].wait(self.readout_interval)  <EOL><DEDENT>else:<EOL><INDENT>if converted_data_tuple is None:  <EOL><INDENT>if self.callback and any(converted_data_tuple_list):<EOL><INDENT>try:<EOL><INDENT>self.callback(converted_data_tuple_list)<EOL><DEDENT>except Exception:<EOL><INDENT>self.errback(sys.exc_info())<EOL><DEDENT><DEDENT>break<EOL><DEDENT>else:<EOL><INDENT>if no_data_timeout and np.any(is_fe_data_header(converted_data_tuple[<NUM_LIT:0>])):  <EOL><INDENT>time_last_data = time()<EOL><DEDENT>if converted_data_tuple_list[index]:<EOL><INDENT>converted_data_tuple_list[index].append(converted_data_tuple)<EOL><DEDENT>else:<EOL><INDENT>converted_data_tuple_list[index] = [converted_data_tuple]  <EOL><DEDENT>if self.fill_buffer:<EOL><INDENT>self._data_buffer[index].append(converted_data_tuple)<EOL><DEDENT><DEDENT><DEDENT>if self.callback and any(converted_data_tuple_list) and ((self.write_interval and time() - time_write >= self.write_interval) or not self.write_interval):<EOL><INDENT>try:<EOL><INDENT>self.callback(converted_data_tuple_list)  <EOL><DEDENT>except Exception:<EOL><INDENT>self.errback(sys.exc_info())<EOL><DEDENT>else:<EOL><INDENT>converted_data_tuple_list = [None] * len(self.filter_func)<EOL>time_write = time()  <EOL><DEDENT><DEDENT><DEDENT>self._data_conditions[index].release()<EOL>logging.debug('<STR_LIT>', index)<EOL>
Writer thread continuously calling callback function for writing data when data becomes available.