code: def _getattr(
      obj: nn.Module, name: str, expected_type: Type | None = None
  ) -> Any:
      # Smart version of getattr().
      # It's used to unify the behavior of nn.XXX and nas_nn.MutableXXX.
  
      # Get from args if it's a mutable module.
      if isinstance(obj, ParametrizedModule):
          val = obj.args[name]
      # Get from nn.Module.
      else:
          val = getattr(obj, name)
  
      # Transform type.
      if expected_type is None:
          return val
  
      if expected_type is tuple_1_t:
          if isinstance(val, tuple):
              return val
          return (_getitem(val, 0),)
      if expected_type is tuple_2_t:
          if isinstance(val, tuple):
              return val
          return (_getitem(val, 0), _getitem(val, 1))
      if expected_type is tuple_3_t:
          if isinstance(val, tuple):
              return val
          return (_getitem(val, 0), _getitem(val, 1), _getitem(val, 2))
      if expected_type is bool:
          if isinstance(val, Mutable):
              return val
          if isinstance(val, (int, float, str, bool)):
              return bool(val)
          return val is not None
      if expected_type is int:
          if isinstance(val, Mutable):
              return val
          if isinstance(val, (int, float, str, bool)):
              return int(val)
          return 1 if val is not None else 0
  
      raise TypeError(f"Unsupported type: {expected_type}")
  
imports: from __future__ import annotations
  from typing import Any, Type, TypeVar, Tuple
  from torch import nn
  from nni.mutable import Mutable, MutableExpression
  from nni.nas.nn.pytorch import ParametrizedModule
label_desc: Use image node_id 2 for calling a global function with example usage: _getattr(obj, name, expected_type) and returns: val, _getitem, _getitem,  _getitem, _getitem,  _getitem,  _getitem, unknown, unknown, val, val, val, val, bool, val, int