code: def update_json_file(filename, items):
      
      if not items:
          return
  
      with open(filename) as fd:
          policy = json.load(fd)
  
      # Compare before and after and if nothing has changed don't write the file
      # since that could cause unnecessary service restarts.
      before = json.dumps(policy, indent=4, sort_keys=True)
      policy.update(items)
      after = json.dumps(policy, indent=4, sort_keys=True)
      if before == after:
          return
  
      with open(filename, "w") as fd:
          fd.write(after)
docs: Updates the json `filename` with a given dict.
      :param filename: path to json file (e.g. /etc/glance/policy.json)
      :param items: dict of items to update