code: def __find_and_remove_value(list, compare):
      
      # next throws if there are no matches
      try:
          found = next(value for value in list
                       if value['name'] == compare['name'] and value['switch'] ==
                       compare['switch'])
      except:
          return None
  
      list.remove(found)
  
      return found
docs: Finds the value in the list that corresponds with the value of compare.