code: def flatten2d(d, key_as_tuple=True, delim='.',
                list_of_dicts=None):
      
      return flattennd(d, 1, key_as_tuple, delim, list_of_dicts=list_of_dicts)
docs: get nested dict as {key:dict,...},
      where key is tuple/string of all-1 nested keys
  
      NB: is same as flattennd(d,1,key_as_tuple,delim)
  
      Parameters
      ----------
      d : dict
      key_as_tuple : bool
          whether keys are list of nested keys or delimited string of nested keys
      delim : str
          if key_as_tuple=False, delimiter for keys
      list_of_dicts: str or None
          if not None, flatten lists of dicts using this prefix
  
      Examples
      --------
  
      >>> from pprint import pprint
  
      >>> d = {1:{2:{3:{'b':'B','c':'C'},4:'D'}}}
      >>> pprint(flatten2d(d))
      {(1, 2): {4: 'D'}, (1, 2, 3): {'b': 'B', 'c': 'C'}}
  
      >>> pprint(flatten2d(d,key_as_tuple=False,delim=','))
      {'1,2': {4: 'D'}, '1,2,3': {'b': 'B', 'c': 'C'}}