code: def opt_to_kwargs(opt):
      """
      Get kwargs for seq2seq from opt.
      """
      kwargs = {}
      for k in [
          "numlayers",
          "dropout",
          "bidirectional",
          "rnn_class",
          "lookuptable",
          "decoder",
          "numsoftmax",
          "attention",
          "attention_length",
          "attention_time",
          "input_dropout",
      ]:
          if k in opt:
              kwargs[k] = opt[k]
      return kwargs
  
imports: import math
  import torch
  import torch.nn
  from torch.nn.parameter import Parameter
  from torch.nn.utils.rnn import pad_packed_sequence, pack_padded_sequence
  import torch.nn.functional
  from parlai.utils.torch import neginf
  from parlai.core.torch_generator_agent import TorchGeneratorModel
label_desc: Use image node_id 2 for calling a global function with example usage: opt_to_kwargs(opt) and returns: kwargs