<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def unpack_response(self, cursor_id=None, codec_options=_UNICODE_REPLACE_CODEC_OPTIONS, user_fields=None, legacy_response=False):
 """Unpack a OP_MSG command response. :Parameters: - `cursor_id` (optional):
 Ignored, for compatibility with _OpReply. - `codec_options` (optional):
 an instance of :class:`~bson.codec_options.CodecOptions` """

        # If _OpMsg is in-use, this cannot be a legacy response.
        assert not legacy_response
        return bson._decode_all_selective(
            self.payload_document, codec_options, user_fields)