code: def apply_format(var, format_str):
      
      if isinstance(var, (list, tuple)):
          new_var = map(lambda x: apply_format(x, format_str), var)
          if isinstance(var, tuple):
              new_var = '(' + ', '.join(new_var) + ')'
          elif isinstance(var, list):
              new_var = '[' + ', '.join(new_var) + ']'
          return '{}'.format(new_var)
      else:
          return format_str.format(var)
docs: Format all non-iterables inside of the iterable var using the format_str
  
      Example:
      >>> print apply_format([2, [1, 4], 4, 1], '{:.1f}')
  
      will return ['2.0', ['1.0', '4.0'], '4.0', '1.0']