def s3_flatlist(nested):
 for item in nested:
  if (isinstance(item, collections.Iterable) and (not isinstance(item, basestring))):
   for sub in s3_flatlist(item):
    (yield sub)
  else:
   (yield item)

def s3_flatlist ( nested ) : for item in nested : if ( isinstance ( item , collections . Iterable ) and ( not isinstance ( item , basestring ) ) ) : for sub in s3_flatlist ( item ) : ( yield sub ) else : ( yield item )
iterator to flatten mixed iterables of arbitrary depth .