code: def opt_to_kwargs(opt):
      """
      Get kwargs for seq2seq from opt.
      """
      kwargs = {}
      for k in [
          "memsize",
          "time_features",
          "position_encoding",
          "hops",
      ]:
          if k in opt:
              kwargs[k] = opt[k]
      return kwargs
  
file_path: ParlAI/parlai/agents/memnn/modules.py
imports: import torch
  import torch.nn
  from parlai.utils.torch import neginf
  from functools import lru_cache
label_desc: Use image node_id 1 for calling a global function with example usage: opt_to_kwargs(opt) and returns: kwargs