def perform_all_actions(all_actions):
 for action_group in all_actions:
  to_destroy = getattr(action_group, 'destroy', [])
  for resource in to_destroy:
   destroy_resource(resource)

def perform_all_actions ( all_actions ) : for action_group in all_actions : to_destroy = getattr ( action_group , 'destroy' , [ ] ) for resource in to_destroy : destroy_resource ( resource )
loop through all the actions and destroy the resources that need to be destroyed .