code: def simplify_sequential(
      sequentials: List[nn.Module],
  ) -> Iterator[nn.Module]:
      """
      Flatten the sequential blocks so that the hierarchy looks better.
      Eliminate identity modules automatically.
      """
      for module in sequentials:
          if isinstance(module, nn.Sequential):
              for submodule in module.children():
                  # no recursive expansion
                  if not isinstance(submodule, nn.Identity):
                      yield submodule
          else:
              if not isinstance(module, nn.Identity):
                  yield module
  
imports: import math
  from typing import Optional, Callable, List, Tuple, Iterator, Union, cast, overload
  import torch
  from torch import nn
  from nni.mutable import MutableExpression
  from nni.nas.nn.pytorch import ModelSpace, LayerChoice, Repeat, MutableConv2d, MutableLinear, MutableBatchNorm2d
  from .utils.pretrained import load_pretrained_weight
label_desc: Use image node_id 4 for calling a global function with example usage: simplify_sequential(sequentials) without return types