title: How to join strings in nested lists while maintaining list hierarchy?
body: <p>I have this list:</p>
  <pre><code>[&quot;a&quot;, &quot;b&quot;, [&quot;c&quot;, [&quot;d&quot;, &quot;e&quot;], &quot;f&quot;]]
  </code></pre>
  <p>I wish to join the string elements in each list together while maintaining the list structure.</p>
  <p>The expected behaviour is something like this:</p>
  <pre><code>&gt;&gt;&gt; test_list = [&quot;a&quot;, &quot;b&quot;, [&quot;c&quot;, [&quot;d&quot;, &quot;e&quot;], &quot;f&quot;]]
  &gt;&gt;&gt; function(test_list)
  [&quot;ab&quot;, [&quot;c&quot;, [&quot;de&quot;], &quot;f&quot;]]
  </code></pre>
  <p>It would be very similar to <a href="https://stackoverflow.com/questions/48978771/how-to-join-nested-list-of-strings-and-get-the-result-as-new-list-of-string">this</a>, but it must able to handle an arbitrary number of nested lists.</p>
  <p>I have tried to solve it using a recursive function but was not able to get the expected outcome.</p>
  <p>Any tips?</p>