class_docstr: A data structure that provides an interface to access nested dictionaries with "flattened keys", and a few more functions.
  
  e.g.
      dct = RecursiveDict({'a':{'b':2}})
      assert dct["a__b"] == 2
      dct["a__b__c"] = 3
      assert dct['a']['b']['c'] == dct["a__b__c"] == dct.to_flat_dict()["a__b__c"]
  
  This class serves as a base for HyperparameterSamples and HyperparameterSpace
class_docstr_tok: ["A","data","structure","that","provides","an","interface","to","access","nested","dictionaries","with","``","flattened","keys","''",",","and","a","few","more","functions",".","e.g",".","dct","=","RecursiveDict","(","{","'","a","'",":","{","'","b':2","}","}",")","assert","dct","[","``","a__b","''","]","==","2","dct","[","``","a__b__c","''","]","=","3","assert","dct","[","'","a","'","]","[","'","b","'","]","[","'","c","'","]","==","dct","[","``","a__b__c","''","]","==","dct.to_flat_dict","(",")","[","``","a__b__c","''","]","This","class","serves","as","a","base","for","HyperparameterSamples","and","HyperparameterSpace"]
code: def _wildcards_reduce(self, rkeys: List[RList[str]], depth=0):
      rkeys = copy(rkeys)
  
      glob_ctr = Counter()
      key_attribution: Dict[str, int] = dict()
  
      def permutations(rkey: RList[str]) -> Set[str]:
          out: Set[str] = set()
          out.add(self.separator.join(rkey))
  
          for i in range(1, len(rkey)):
              for j in range(i, len(rkey)):
                  for k in range(j, len(rkey)):
                      rk = (
                          rkey[:i]
                          + (["*"] if i != j else [])
                          + rkey[j:k]
                          + (["*"] if k != len(rkey) else [])
                      )
                      rks = self.separator.join(rk)
                      rks = rks.replace(
                          f"*{self.separator}*", "*"
                      ).replace(f"*{self.separator}*", "*")
  
                      out.add(rks)
          return out
  
      for i, rkey in enumerate(rkeys):
          rk_perms: Set[str] = permutations(rkey)
          glob_ctr.update(rk_perms)
          for rk in rk_perms:
              key_attribution[rk] = i
  
      # remove the keys that have a count of more than 1 in the counter:
      glob_ctr = {k: v for k, v in glob_ctr.items() if v == 1}
      attribution_keys: Dict[int, List[str]] = defaultdict(list)
      key_attribution = {
          attribution_keys[idx].append(rks)
          for rks, idx in key_attribution.items()
          if rks in glob_ctr.keys()
      }
  
      # keep the shortest key:
      attributed_key: Dict[str, str] = {
          k: min(
              v,
              key=lambda x: len(
                  x.replace(f"{self.separator}*", "*").replace(
                      f"*{self.separator}", "*"
                  )
              ),
          )
          for k, v in attribution_keys.items()
      }
      attributed_key = {
          k: v.split(self.separator) for k, v in attributed_key.items()
      }
      keys = [v for k, v in sorted(attributed_key.items())]
      return keys
  
imports: import typing
  from collections import Counter, OrderedDict, defaultdict
  from copy import copy
  from typing import Any, Dict, Iterable, List, Set, Union
  from neuraxle.hyperparams.distributions import FixedHyperparameter, HPSampledValue, HyperparameterDistribution
  from neuraxle.hyperparams.scipy_distributions import ScipyContinuousDistributionWrapper, ScipyDiscreteDistributionWrapper
  from scipy.stats import rv_continuous, rv_discrete
  from scipy.stats._distn_infrastructure import rv_generic
label_desc: Use image node_id 16 for calling the RecursiveDict obj's underlying member method code with example usage: obj._wildcards_reduce(rkeys, depth) and returns: keys, out