code: def body_as_str(self, encoding='UTF-8'):
          
          data = self.body
          try:
              return "".join(b.decode(encoding) for b in data)
          except TypeError:
              return six.text_type(data)
          except:  # pylint: disable=bare-except
              pass
          try:
              return data.decode(encoding)
          except Exception as e:
              raise TypeError("Message data is not compatible with string type: {}".format(e))
docs: The body of the event data as a string if the data is of a
          compatible type.
  
          :param encoding: The encoding to use for decoding message data.
           Default is 'UTF-8'
          :rtype: str or unicode