code: def update_key_bundle(key_bundle, diff):
      
      try:
          _add = diff['add']
      except KeyError:
          pass
      else:
          key_bundle.extend(_add)
  
      try:
          _del = diff['del']
      except KeyError:
          pass
      else:
          _now = time.time()
          for k in _del:
              k.inactive_since = _now
docs: Apply a diff specification to a KeyBundle.
      The keys that are to be added are added.
      The keys that should be deleted are marked as inactive.
  
      :param key_bundle: The original KeyBundle
      :param diff: The difference specification
      :return: An updated key_bundle