code: def unmarshal_event(self, data: str, response_type):
          
          js = json.loads(data)
  
          # Make a copy of the original object and save it under the
          # `raw_object` key because we will replace the data under `object` with
          # a Python native type shortly.
          js['raw_object'] = js['object']
  
          # Something went wrong. A typical example would be that the user
          # supplied a resource version that was too old. In that case K8s would
          # not send a conventional ADDED/DELETED/... event but an error. Turn
          # this error into a Python exception to save the user the hassle.
          if js['type'].lower() == 'error':
              return js
  
          # If possible, compile the JSON response into a Python native response
          # type, eg `V1Namespace` or `V1Pod`,`ExtensionsV1beta1Deployment`, ...
          if response_type is not None:
              js['object'] = self._api_client.deserialize(
                  response=SimpleNamespace(data=json.dumps(js['raw_object'])),
                  response_type=response_type
              )
  
              # decode and save resource_version to continue watching
              if hasattr(js['object'], 'metadata'):
                  self.resource_version = js['object'].metadata.resource_version
  
              # For custom objects that we don't have model defined, json
              # deserialization results in dictionary
              elif (isinstance(js['object'], dict) and
                    'metadata' in js['object'] and
                    'resourceVersion' in js['object']['metadata']):
  
                  self.resource_version = js['object']['metadata']['resourceVersion']
  
          return js
docs: Return the K8s response `data` in JSON format.