code: def unpack(cls, msg, client, server, request_id):
          
          flags, = _UNPACK_INT(msg[:4])
          namespace, pos = _get_c_string(msg, 4)
          is_command = namespace.endswith('.$cmd')
          num_to_skip, = _UNPACK_INT(msg[pos:pos + 4])
          pos += 4
          num_to_return, = _UNPACK_INT(msg[pos:pos + 4])
          pos += 4
          docs = bson.decode_all(msg[pos:], CODEC_OPTIONS)
          if is_command:
              assert len(docs) == 1
              command_ns = namespace[:-len('.$cmd')]
              return Command(docs, namespace=command_ns, flags=flags,
                             _client=client, request_id=request_id,
                             _server=server)
          else:
              if len(docs) == 1:
                  fields = None
              else:
                  assert len(docs) == 2
                  fields = docs[1]
              return OpQuery(docs[0], fields=fields, namespace=namespace,
                             flags=flags, num_to_skip=num_to_skip,
                             num_to_return=num_to_return, _client=client,
                             request_id=request_id, _server=server)
docs: Parse message and return an `OpQuery` or `Command`.
  
          Takes the client message as bytes, the client and server socket objects,
          and the client request id.