code: def flatten(dic, keep_iter=False, position=None):
      
      child = {}
      if not dic:
          return {}
  
      for k, v in get_iter(dic):
          if isstr(k):
              k = k.replace('.', '_')
          if position:
              item_position = '%s.%s' % (position, k)
          else:
              item_position = '%s' % k
  
          if is_iter(v):
              child.update(flatten(dic[k], keep_iter, item_position))
              if keep_iter:
                  child[item_position] = v
          else:
              child[item_position] = v
  
      return child
docs: Returns a flattened dictionary from a dictionary of nested dictionaries and lists.
      `keep_iter` will treat iterables as valid values, while also flattening them.