code: def modified_environ(*remove: str, **update: str) -> Iterator[None]:
      
      env = os.environ
      update = update or {}
      remove = remove or ()
  
      # List of environment variables being updated or removed.
      stomped = (set(update.keys()) | set(remove)) & set(env.keys())
      # Environment variables and values to restore on exit.
      update_after = {k: env[k] for k in stomped}
      # Environment variables and values to remove on exit.
      remove_after = frozenset(k for k in update if k not in env)
  
      try:
          env.update(update)
          [env.pop(k, None) for k in remove]  # pylint: disable=expression-not-assigned
          yield
      finally:
          env.update(update_after)
          [env.pop(k) for k in remove_after]
docs: Temporarily updates the ``os.environ`` dictionary in-place and resets it to the original state
      when finished.
      (https://stackoverflow.com/questions/2059482/
          python-temporarily-modify-the-current-processs-environment/34333710#34333710)
  
      The ``os.environ`` dictionary is updated in-place so that the modification is sure to work in
      all situations.
  
      Args:
          remove: Environment variables to remove.
          update: Dictionary of environment variables and values to add/update.
  
      Examples:
          >>> with modified_environ(Test='abc'):
          ...     import os
          ...     print(os.environ.get('Test'))
          abc
          >>> print(os.environ.get('Test'))
          None