def __init__(self, body='', delivery_info=None, return_info=None,
                 **properties):
        '''
        :param delivery_info: pass only if messages was received via
          basic.deliver or basic.get_ok; MUST be None otherwise; default: None
        :param return_info: pass only if message was returned via basic.return;
          MUST be None otherwise; default: None
        '''
        if isinstance(body, unicode):
            if 'content_encoding' not in properties:
                properties['content_encoding'] = 'utf-8'
            body = body.encode(properties['content_encoding'])

        if not isinstance(body, (str, unicode, bytearray)):
            raise TypeError("Invalid message content type %s" % (type(body)))

        self._body = body
        self._delivery_info = delivery_info
        self._return_info = return_info
        self._properties = properties
dataset/ETHPy150Open agoragames/haigha/haigha/message.py/Message.__init__/original