def _maybe_decode(self, value, encoding='utf-8'):
        """If a bytes object is passed in, in the Python 3 environment,
        decode it using the specified encoding to turn it to a str instance.

        :param mixed value: The value to possibly decode
        :param str encoding: The encoding to use
        :rtype: str

        """
        if _PYTHON3 and isinstance(value, bytes):
            try:
                return value.decode(encoding)
            except Exception as err:
                self.logger.exception('Error decoding value: %s', err)
                raise MessageException(
                    str(err), 'decoding-{}'.format(encoding))
        return value
If a bytes object is passed in, in the Python 3 environment,
        decode it using the specified encoding to turn it to a str instance.

        :param mixed value: The value to possibly decode
        :param str encoding: The encoding to use
        :rtype: str