code: def create_new_module(
      target_module: torch.nn.Module,
      rank: int,
      alpha: int,
      dropout_rate: float,
  ):
      """Create a new module for the given target module."""
  
      bias = (
          hasattr(target_module, "bias")
          and target_module.bias is not None
      )
  
      if isinstance(target_module, torch.nn.Embedding):
          new_module = lora.Embedding(
              target_module.num_embeddings,
              target_module.embedding_dim,
              r=rank,
              lora_alpha=alpha,
          )
      elif isinstance(target_module, torch.nn.Linear):
          new_module = lora.Linear(
              target_module.in_features,
              target_module.out_features,
              bias=bias,
              r=rank,
              lora_alpha=alpha,
              lora_dropout=dropout_rate,
          )
      else:
          raise ValueError(
              f"Target module {target_module} is not supported. "
              f"Currently, only `torch.nn.Embedding`, `torch.nn.Conv2d` "
              f"`torch.nn.Linear` and are supported."
          )
  
      return new_module
  
imports: from typing import List
  import torch
  from typeguard import check_argument_types
label_desc: Use image node_id 4 for calling a global function with example usage: create_new_module(target_module, rank, alpha, dropout_rate) and returns: new_module