<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_text(self, m_data):
        '''
        Raises ValueError if a value doesn't work out, and TypeError if
        this isn't a message type
        '''
        if m_data.get('type') != 'message':
            raise TypeError('This is not a message')
        # Edited messages have text in message
        _text = m_data.get('text', None) or m_data.get('message', {}).get('text', None)
        try:
            log.info('Message is %s', _text)  # this can violate the ascii codec
        except UnicodeEncodeError as uee:
            log.warning('Got a message that I could not log. The reason is: %s', uee)

        # Convert UTF to string
        _text = salt.utils.json.dumps(_text)
        _text = salt.utils.yaml.safe_load(_text)

        if not _text:
            raise ValueError('_text has no value')
        return _text