code: def get_pos_enc_and_att_class(
      net_part: str, pos_enc_type: str, self_attn_type: str
  ) -> Tuple[
      Union[
          PositionalEncoding,
          ScaledPositionalEncoding,
          RelPositionalEncoding,
      ],
      Union[MultiHeadedAttention, RelPositionMultiHeadedAttention],
  ]:
      """Get positional encoding and self attention module class.
  
      Args:
          net_part: Network part, either 'encoder' or 'decoder'.
          pos_enc_type: Positional encoding type.
          self_attn_type: Self-attention type.
  
      Return:
          pos_enc_class: Positional encoding class.
          self_attn_class: Self-attention class.
  
      """
      if pos_enc_type == "abs_pos":
          pos_enc_class = PositionalEncoding
      elif pos_enc_type == "scaled_abs_pos":
          pos_enc_class = ScaledPositionalEncoding
      elif pos_enc_type == "rel_pos":
          if (
              net_part == "encoder"
              and self_attn_type != "rel_self_attn"
          ):
              raise ValueError(
                  "'rel_pos' is only compatible with 'rel_self_attn'"
              )
          pos_enc_class = RelPositionalEncoding
      else:
          raise NotImplementedError(
              "pos_enc_type should be either 'abs_pos', 'scaled_abs_pos' or 'rel_pos'"
          )
  
      if self_attn_type == "rel_self_attn":
          self_attn_class = RelPositionMultiHeadedAttention
      else:
          self_attn_class = MultiHeadedAttention
  
      return pos_enc_class, self_attn_class
  
imports: from typing import Any, Dict, List, Tuple, Union
  import torch
  from espnet.nets.pytorch_backend.conformer.convolution import ConvolutionModule
  from espnet.nets.pytorch_backend.conformer.encoder_layer import EncoderLayer
  from espnet.nets.pytorch_backend.nets_utils import get_activation
  from espnet.nets.pytorch_backend.transducer.conv1d_nets import CausalConv1d, Conv1d
  from espnet.nets.pytorch_backend.transducer.transformer_decoder_layer import TransformerDecoderLayer
  from espnet.nets.pytorch_backend.transducer.vgg2l import VGG2L
  from espnet.nets.pytorch_backend.transformer.attention import MultiHeadedAttention, RelPositionMultiHeadedAttention
  from espnet.nets.pytorch_backend.transformer.embedding import PositionalEncoding, RelPositionalEncoding, ScaledPositionalEncoding
  from espnet.nets.pytorch_backend.transformer.encoder_layer import EncoderLayer
  from espnet.nets.pytorch_backend.transformer.positionwise_feed_forward import PositionwiseFeedForward
  from espnet.nets.pytorch_backend.transformer.repeat import MultiSequential
  from espnet.nets.pytorch_backend.transformer.subsampling import Conv2dSubsampling
label_desc: Use image node_id 4 for calling a global function with example usage: get_pos_enc_and_att_class(net_part, pos_enc_type, _attn_type) and returns: pos_enc_class,  self_attn_class