def collect(resource_obj, list_kwargs, name_filter, before_str=None):
 result = []
 request = resource_obj.list(**list_kwargs)
 while request:
  response = request.execute()
  result.extend(__filter_items(response.get('items', []), name_filter, before_str))
  try:
   request = resource_obj.list_next(request, response)
  except AttributeError:
   request = None
 return result

def collect ( resource_obj , list_kwargs , name_filter , before_str = None ) : result = [ ] request = resource_obj . list ( ** list_kwargs ) while request : response = request . execute ( ) result . extend ( __filter_items ( response . get ( 'items' , [ ] ) , name_filter , before_str ) ) try : request = resource_obj . list_next ( request , response ) except AttributeError : request = None return result
instead of performing bulk delete .