code: def test_flatten():
      in_list = [[1, 2, 3], [4], [[5, 6], 7], 8]
  
      flat = flatten(in_list)
      assert flat == [1, 2, 3, 4, 5, 6, 7, 8]
  
      back = unflatten(flat, in_list)
      assert in_list == back
  
      new_list = [2, 3, 4, 5, 6, 7, 8, 9]
      back = unflatten(new_list, in_list)
      assert back == [[2, 3, 4], [5], [[6, 7], 8], 9]
  
      flat = flatten([])
      assert flat == []
  
      back = unflatten([], [])
      assert back == []
  
file_path: nipype/nipype/utils/tests/test_misc.py
imports: import os
  from shutil import rmtree
  import pytest
  from nipype.utils.misc import container_to_string, str2bool, flatten, unflatten, dict_diff
label_desc: Use image node_id 3 for calling a global function with example usage: test_flatten() without return types