code: def unflatten(in_list, prev_structure):
      if not isinstance(in_list, Iterator):
          in_list = iter(in_list)
  
      if not isinstance(prev_structure, list):
          return next(in_list)
  
      out = []
      for item in prev_structure:
          out.append(unflatten(in_list, item))
      return out
  
file_path: nipype/nipype/utils/misc.py
imports: import os
  import sys
  import re
  from collections.abc import Iterator
  from warnings import warn
  from looseversion import LooseVersion
  import numpy
  import textwrap
label_desc: Use image node_id 9 for calling a global function with example usage: unflatten(in_list, prev_structure) and returns: out, next