code: def _expand_target(
      target: TargetType,
      n_steps: int,
      expansion_type: ExpansionTypes = ExpansionTypes.repeat,
  ) -> TargetType:
      if isinstance(target, list):
          if expansion_type == ExpansionTypes.repeat:
              return target * n_steps
          elif expansion_type == ExpansionTypes.repeat_interleave:
              expanded_target = []
              for i in target:
                  expanded_target.extend([i] * n_steps)
              return cast(
                  Union[List[Tuple[int, ...]], List[int]],
                  expanded_target,
              )
          else:
              raise NotImplementedError(
                  "Currently only `repeat` and `repeat_interleave`"
                  " expansion_types are supported"
              )
  
      elif isinstance(target, torch.Tensor) and torch.numel(target) > 1:
          if expansion_type == ExpansionTypes.repeat:
              return torch.cat([target] * n_steps, dim=0)
          elif expansion_type == ExpansionTypes.repeat_interleave:
              return target.repeat_interleave(n_steps, dim=0)
          else:
              raise NotImplementedError(
                  "Currently only `repeat` and `repeat_interleave`"
                  " expansion_types are supported"
              )
  
      return target
  
imports: import typing
  from enum import Enum
  from functools import reduce
  from inspect import signature
  from typing import Any, Callable, cast, Dict, List, overload, Tuple, Union
  import numpy
  import torch
  from captum._utils.typing import BaselineType, Literal, TargetType, TensorOrTupleOfTensorsGeneric, TupleOrTensorOrBoolGeneric
  from torch import device, Tensor
  from torch.nn import Module
label_desc: Use image node_id 22 for calling a global function with example usage: _expand_target(target, n_steps, expansion_type) and returns: target, unknown, cast, torch, target