def print_and_modify(obj, mods, dels):
 obj.update(mods)
 for field in dels:
  try:
   del obj[field]
  except KeyError:
   pass
 return ui.show_model_changes(obj)

def print_and_modify ( obj , mods , dels ) : obj . update ( mods ) for field in dels : try : del obj [ field ] except KeyError : pass return ui . show_model_changes ( obj )
print the modifications to an item and return a bool indicating whether any changes were made .