code: def update_nested(
      original: MutableMapping, update: Mapping, copy: bool = False
  ) -> MutableMapping:
      """Update nested dictionaries
  
      Parameters
      ----------
      original : MutableMapping
          the original (nested) dictionary, which will be updated in-place
      update : Mapping
          the nested dictionary of updates
      copy : bool, default False
          if True, then copy the original dictionary rather than modifying it
  
      Returns
      -------
      original : MutableMapping
          a reference to the (modified) original dict
  
      Examples
      --------
      >>> original = {'x': {'b': 2, 'c': 4}}
      >>> update = {'x': {'b': 5, 'd': 6}, 'y': 40}
      >>> update_nested(original, update)  # doctest: +SKIP
      {'x': {'b': 5, 'c': 4, 'd': 6}, 'y': 40}
      >>> original  # doctest: +SKIP
      {'x': {'b': 5, 'c': 4, 'd': 6}, 'y': 40}
      """
      if copy:
          original = deepcopy(original)
      for key, val in update.items():
          if isinstance(val, Mapping):
              orig_val = original.get(key, {})
              if isinstance(orig_val, MutableMapping):
                  original[key] = update_nested(orig_val, val)
              else:
                  original[key] = val
          else:
              original[key] = val
      return original
  
imports: from collections.abc import Mapping, MutableMapping
  from copy import deepcopy
  import json
  import itertools
  import re
  import sys
  import traceback
  import warnings
  from typing import Callable, TypeVar, Any, Union, Dict, Optional, Tuple, Sequence, Type, cast
  from types import ModuleType
  import jsonschema
  import pandas
  import numpy
  from pandas.api.types import infer_dtype
  from altair.utils.schemapi import SchemaBase
  from altair.utils._dfi_types import Column, DtypeKind, DataFrame
  from typing import Literal, Protocol, TYPE_CHECKING
label_desc: Use image node_id 10 for calling a global function with example usage: update_nested(original, update, copy) and returns: original