code: def set_hook_data(self, key, data):
          
  
          if not isinstance(data, collections.Mapping):
              raise ValueError("Hook (key: %s) data must be an instance of "
                               "collections.Mapping (a dictionary for "
                               "example)." % key)
  
          if key in self.hook_data:
              raise KeyError("Hook data for key %s already exists, each hook "
                             "must have a unique data_key.", key)
  
          self.hook_data[key] = data
docs: Set hook data for the given key.
  
          Args:
              key(str): The key to store the hook data in.
              data(:class:`collections.Mapping`): A dictionary of data to store,
                  as returned from a hook.