title: apply a function over each element of an iterable with sublists
body: <p>I'm trying to apply a function to every element of a list containing arbitrary sub-levels of sublists. Like so.</p>
  <pre class="lang-py prettyprint-override"><code>a = [1,2,3]
  b = [[1,2,3],[4,5,6]]
  c = [[[1,2,3],[4,5,6]],[[7,8,9],[10,11,12]]]
  
  function = lambda x: x+1
  def apply(iterable,f): 
      # do stuff here
  </code></pre>
  <pre><code>print(apply(a,function)) # [2,3,4]
  print(apply(b,function)) # [[2,3,4],[5,6,7]]
  print(apply(c,function)) # [[[2,3,4],[5,6,7]],[[8,9,10],[11,12,13]]]
  </code></pre>
  <p>basically i can't find a way to write the <code>apply</code> function. I tried with numpy, but that's not the solution, of course, because the contents of the list could also be strings, objects ...</p>