input: 
  def findMaxValue(d: dict) -> int:
      """
      Find the maximum value within a nested dictionary.
      >>> findMaxValue({"key1": {"value1": 10, "value2": 20}, "key2": {"value3": 40}})
      40
      >>> findMaxValue({"a": {"b": 20, "c": {"d": 40, "e": 30}}, "f": 50})
      50
      """
      max_val = None
      for key, value in d.items():
          if isinstance(value, dict):
              max_val = max(findMaxValue(value), max_val, default=None)
          else:
              max_val = max(value, max_val, default=None)
      return max_val
  
output:     max_val = None
      for key, value in d.items():
          if isinstance(value, dict):
              max_val = max(findMaxValue(value), max_val, default=None)
          else:
              max_val = max(value, max_val, default=None)
      return max_val