<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def set_table_data(self, tableid, data, offset=None):
 		""" 		Write data to a table. 		:param int tableid: The table number to write to (0x0000 <= tableid <= 0xffff) 		:param str data: The data to write into the table. 		:param int offset: The offset at which to start to write the data (0x000000 <= octetcount <= 0xffffff). 		"""

		self.send(C1218WriteRequest(tableid, data, offset))
		data = self.recv()
		if data[0] != 0x00:
			status = data[0]
			details = (C1218_RESPONSE_CODES.get(status) or 'unknown response code')
			self.logger.error('could not write data to the table, error: ' + details)
			raise C1218WriteTableError('could not write data to the table, error: ' + details, status)
		return