code: def modify_dict(data, key, value, create_if_missing=False):
      
      data_copy = copy.deepcopy(data)
      key_copy = copy.deepcopy(key)
  
      delver = data_copy
      current_key = key_copy
      last_key = "Root"
  
      # Dig through the json, setting delver to the dict that contains the last key in "key"
      while len(current_key) > 1:
          if current_key[0] not in delver:
              raise KeyError("ModifyJsonStep Key Couldn't find Subkey {} in {}.".format(current_key[0], last_key))
  
          if len(current_key) > 2 and not isinstance(delver[current_key[0]], dict):
              raise ValueError("ModifyJsonStep The Value of {} is a {}, not a dict".format(current_key[0], type(delver[current_key[0]])))
  
          last_key = current_key[0]
          delver = delver[current_key[0]]
          current_key.pop(0)
  
      if current_key[0] not in delver and not create_if_missing:
          raise KeyError("ModifyJsonStep Key Couldn't find Subkey {} in {}.".format(current_key[0], last_key))
  
      delver[current_key[0]] = value
  
      return data_copy
docs: Change (or add) a json key/value pair.
  
      Args:
          data (dict): The original data. This will not be modified.
          key (list): A list of keys and subkeys specifing the key to change (list can be one)
          value (str): The value to change for the above key
          create_if_missing (bool): Set to true to create key if the last key in the list is not found
                  Otherwise the function will throw a KeyError
      Returns:
          (dict): the final modified dict