def iterate_all(attr, map_method, **kwargs):
 args = dict(((key, value) for (key, value) in kwargs.items() if (value is not None)))
 wait = 1
 while True:
  try:
   data = map_method(**args)
   for elm in data[attr]:
    (yield elm)
   if ('NextMarker' in data):
    args['Marker'] = data['Nextmarker']
    continue
   break
  except ClientError as e:
   if ((e.response['Error']['Code'] == 'ThrottlingException') and (wait < 600)):
    sleep(wait)
    wait = (wait * 2)
    continue

def iterate_all ( attr , map_method , ** kwargs ) : args = dict ( ( ( key , value ) for ( key , value ) in kwargs . items ( ) if ( value is not None ) ) ) wait = 1 while True : try : data = map_method ( ** args ) for elm in data [ attr ] : ( yield elm ) if ( 'NextMarker' in data ) : args [ 'Marker' ] = data [ 'Nextmarker' ] continue break except ClientError as e : if ( ( e . response [ 'Error' ] [ 'Code' ] == 'ThrottlingException' ) and ( wait < 600 ) ) : sleep ( wait ) wait = ( wait * 2 ) continue
method creates iterator from boto result set .