code: def ema_scope(self, context=None):
      if self.use_ema:
          self.model_ema.store(self.parameters())
          self.model_ema.copy_to(self)
          if context is not None:
              print(f"{context}: Switched to EMA weights")
      try:
          yield None
      finally:
          if self.use_ema:
              self.model_ema.restore(self.parameters())
              if context is not None:
                  print(f"{context}: Restored training weights")
  
imports: import numpy
  import torch
  import pytorch_lightning
  import torch.nn.functional
  from contextlib import contextmanager
  from torch.optim.lr_scheduler import LambdaLR
  from ldm.modules.ema import LitEma
  from vqvae_quantize import VectorQuantizer2
  from ldm.modules.diffusionmodules.model import Encoder, Decoder
  from ldm.util import instantiate_from_config
  import ldm.models.autoencoder
  from packaging import version
label_desc: Use image node_id 2 for calling the VQModel obj's underlying member method code with example usage: obj.ema_scope(context) without return types