code: def _resized(
      obj: Plot, width: int | None, height: int | None
  ) -> Iterator[None]:
      old_width = obj.width
      old_height = obj.height
  
      if width is not None:
          obj.width = width
      if height is not None:
          obj.height = height
  
      yield
  
      obj.width = old_width
      obj.height = old_height
  
imports: from __future__ import annotations
  import logging
  import io
  import os
  from contextlib import contextmanager
  from os.path import abspath, expanduser, splitext
  from tempfile import mkstemp
  from typing import TYPE_CHECKING, Any, Iterator, cast
  from ..core.types import PathLike
  from ..document import Document
  from ..embed import file_html
  from ..resources import INLINE, Resources
  from ..themes import Theme
  from ..util.warnings import warn
  from .state import State, curstate
  from .util import default_filename
label_desc: Use image node_id 9 for calling a global function with example usage: _resized(obj, width, height) without return types