title: Python: How to loop a list of lists of varying depth?
body: <p>I have a data structure like this (the actual lists of lists are very long and of varying depth).  I do know their depth beforehand.  </p>
  
  <pre><code> a=( [1,2], [2,3,[4,5]] )
   b=( [[1,2],[2,3]] )
  </code></pre>
  
  <p>A want to loop through each single list. How to best do this?</p>
  
  <p>I don't want to end up doing something like this:</p>
  
  <pre><code>for l in a:
      if instance(l, list):
          for ll in l:
              if instance(ll, list): 
                  ...
  </code></pre>