input: Write a function to find the maximum value within a nested dictionary. The function should recursively traverse the dictionary to find the maximum value stored in any of its nested keys.
  
  def findMaxValue(d):
      max_val = None
      for key, value in d.items():
          if isinstance(value, dict):
              max_val = max(findMaxValue(value), max_val, key=lambda x: x if x is not None else float('-inf'))
          else:
              max_val = max(value, max_val, key=lambda x: x if x is not None else float('-inf'))
      return max_val
  
  assert findMaxValue({"key1": {"value1": 10, "value2": 20}, "key2": {"value3": 40}})==40
  assert findMaxValue({"a": {"b": 5, "c": {"d": 20, "e": 7}}, "f": 3})==20
  assert findMaxValue({"key": 5})==5
  assert findMaxValue({"key": {"key2": 3, "key3": {"key4": 6}}})==6
  assert findMaxValue({})==None
output: def findMaxValue(d):
      max_val = None
      for key, value in d.items():
          if isinstance(value, dict):
              max_val = max(findMaxValue(value), max_val, key=lambda x: x if x is not None else float('-inf'))
          else:
              max_val = max(value, max_val, key=lambda x: x if x is not None else float('-inf'))
      return max_val