docs: def _recv_msg(self, mid_stream=False):
          """
          :param mid_stream: are we receiving in a streaming operation?
          :type mid_stream: boolean
          """
          try:
              msgbuf = self._recv_pkt()
          except BadResource as e:
              e.mid_stream = mid_stream
              raise
          except socket.timeout as e:
              # A timeout can leave the socket in an inconsistent state because
              # it might still receive the data later and mix up with a
              # subsequent request.
              # https://github.com/basho/riak-python-client/issues/425
              raise BadResource(e, mid_stream)
          mv = memoryview(msgbuf)
          mcb = mv[0:1]
          if self.bytes_required:
              mcb = mcb.tobytes()
          try:
              msg_code, = struct.unpack("B", mcb)
          except struct.error:
              # NB: Python 2.7.3 requires this
              # http://bugs.python.org/issue10212
              msg_code, = struct.unpack("B", mv[0:1].tobytes())
              self.bytes_required = True
          data = mv[1:].tobytes()
          return (msg_code, data)