code: def get_lstm_mod_weights(mod: nn.Module) -> List[torch.Tensor]:
      # TODO(future PR): make more generic, handle everything
      if isinstance(mod, nn.LSTM):
          res = []
          for idx, param_name in enumerate(mod._flat_weights_names):
              if (
                  "weight_ih_l" in param_name
                  or "weight_hh_l" in param_name
              ):
                  param_value = mod._flat_weights[idx].detach()
                  res.append(param_value)
          return res
      else:
          assert isinstance(
              mod, nnqd.LSTM
          ), f"type {type(mod)} not handled yet"
          res = []
          for weight_value in mod._all_weight_values:
              res.append(
                  weight_value.param.__getstate__()[0][4][
                      0
                  ].__getstate__()[0][0]
              )
              res.append(
                  weight_value.param.__getstate__()[0][4][
                      1
                  ].__getstate__()[0][0]
              )
          return res
  
imports: import torch
  import torch.nn
  import torch.nn.functional
  import torch.ao.nn.quantized.dynamic
  import torch.ao.nn.quantized
  import torch.ao.nn.intrinsic.qat
  import torch.ao.nn.qat
  import torch.ao.nn.intrinsic
  import torch.ao.nn.intrinsic.quantized
  from torch.fx import GraphModule
  from torch.fx.graph import Node
  from .utils import get_target_type_str, getattr_from_fqn, return_first_non_observer_node
  from .ns_types import NSSingleResultValuesType, NSSingleResultType
  from typing import List, Optional, Dict, Callable
label_desc: Use image node_id 8 for calling a global function with example usage: get_lstm_mod_weights(mod) and returns: res, res