def get_table_data(self, tableid, octetcount=None, offset=None):
if self.caching_enabled and tableid in self._cacheable_tables and tableid in self._table_cache.keys():<EOL><INDENT>self.logger.info('<STR_LIT>' + str(tableid))<EOL>return self._table_cache[tableid]<EOL><DEDENT>self.send(C1218ReadRequest(tableid, offset, octetcount))<EOL>data = self.recv()<EOL>status = data[<NUM_LIT:0>]<EOL>if status != <NUM_LIT>:<EOL><INDENT>status = status<EOL>details = (C1218_RESPONSE_CODES.get(status) or '<STR_LIT>')<EOL>self.logger.error('<STR_LIT>' + str(tableid) + '<STR_LIT>' + details)<EOL>raise C1218ReadTableError('<STR_LIT>' + str(tableid) + '<STR_LIT>' + details, status)<EOL><DEDENT>if len(data) < <NUM_LIT:4>:<EOL><INDENT>if len(data) == <NUM_LIT:0>:<EOL><INDENT>self.logger.error('<STR_LIT>' + str(tableid) + '<STR_LIT>')<EOL>raise C1218ReadTableError('<STR_LIT>' + str(tableid) + '<STR_LIT>')<EOL><DEDENT>self.logger.error('<STR_LIT>' + str(tableid) + '<STR_LIT>')<EOL>raise C1218ReadTableError('<STR_LIT>' + str(tableid) + '<STR_LIT>')<EOL><DEDENT>length = struct.unpack('<STR_LIT>', data[<NUM_LIT:1>:<NUM_LIT:3>])[<NUM_LIT:0>]<EOL>chksum = data[-<NUM_LIT:1>]<EOL>data = data[<NUM_LIT:3>:-<NUM_LIT:1>]<EOL>if len(data) != length:<EOL><INDENT>self.logger.error('<STR_LIT>' + str(tableid) + '<STR_LIT>')<EOL>raise C1218ReadTableError('<STR_LIT>' + str(tableid) + '<STR_LIT>')<EOL><DEDENT>if not check_data_checksum(data, chksum):<EOL><INDENT>self.logger.error('<STR_LIT>' + str(tableid) + '<STR_LIT>')<EOL>raise C1218ReadTableError('<STR_LIT>' + str(tableid) + '<STR_LIT>')<EOL><DEDENT>if self.caching_enabled and tableid in self._cacheable_tables and not tableid in self._table_cache.keys():<EOL><INDENT>self.logger.info('<STR_LIT>' + str(tableid))<EOL>self._table_cache[tableid] = data<EOL><DEDENT>return data<EOL>
Read data from a table. If successful, all of the data from the
requested table will be returned.

:param int tableid: The table number to read from (0x0000 <= tableid <= 0xffff)
:param int octetcount: Limit the amount of data read, only works if
  the meter supports this type of reading.
:param int offset: The offset at which to start to read the data from.