title: Apply a function to every item of an arbitrarily nested list
body: <p>I have a nested list <code>a = [1, 2, [3, 4], 5]</code> and I want to apply a function that will raise every number to the power of 2. The result will be like this:</p>
  <pre><code>a = [1, 4, [9, 16], 25]
  </code></pre>
  <p>I tried <code>a = [list(map(lambda x : x * x, x)) for x in a]</code> but it gives this error</p>
  <pre class="lang-none prettyprint-override"><code>'int' object is not iterable
  </code></pre>
  <p>How we can fix this issue? How can I apply a function over a nested list?</p>