code: def _decode_received(self, msg):
          
          if not isinstance(msg, six.binary_type):
              # already decoded - do nothing
              return msg
          # only decode from utf-8 if message is not binary data
          type = six.byte2int(msg[0:1])
          if type >= 48:  # no binary
              return msg.decode('utf-8')
          # binary message, don't try to decode
          return msg
docs: Returns either bytes or str, depending on message type.