(key, try_dict, max_depth=10)
return key
Recursively map dictionary keys to values.
Recursively map dictionary keys to values.
Recursively map dictionary keys to values .
def recursive_dict_lookup(key, try_dict, max_depth=10):
  """Recursively map dictionary keys to values."""
  if max_depth < 0:
    raise KeyError("Maximum recursion depth exceeded")
  while key in try_dict:
    key = try_dict[key]
    return recursive_dict_lookup(key, try_dict, max_depth - 1)
  return key
def recursive_dict_lookup ( key , try_dict , max_depth = 10 ) : if max_depth < 0 : raise KeyError ( "Maximum recursion depth exceeded" ) while key in try_dict : key = try_dict [ key ] return recursive_dict_lookup ( key , try_dict , max_depth - 1 ) return key