<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def message_tc(self, message, max_length=255):
 """Write data to message_tc file in TcEX specified directory. This method is used to set and exit message in the ThreatConnect Platform. ThreatConnect only supports files of max_message_length. Any data exceeding this limit will be truncated by this method. Args: message (string):
 The message to add to message_tc file """

        if os.access(self.default_args.tc_out_path, os.W_OK):
            message_file = '{}/message.tc'.format(self.default_args.tc_out_path)
        else:
            message_file = 'message.tc'

        message = '{}\n'.format(message)
        if max_length - len(message) > 0:
            with open(message_file, 'a') as mh:
                mh.write(message)
        elif max_length > 0:
            with open(message_file, 'a') as mh:
                mh.write(message[:max_length])
        max_length -= len(message)