code: def _format_output(
      is_inputs_tuple: bool, output: Tuple[Tensor, ...]
  ) -> Union[Tensor, Tuple[Tensor, ...]]:
      r"""
      In case input is a tensor and the output is returned in form of a
      tuple we take the first element of the output's tuple to match the
      same shape signatues of the inputs
      """
      assert isinstance(
          output, tuple
      ), "Output must be in shape of a tuple"
      assert is_inputs_tuple or len(output) == 1, (
          "The input is a single tensor however the output isn't."
          "The number of output tensors is: {}".format(len(output))
      )
      return output if is_inputs_tuple else output[0]
  
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 31 for calling a global function with example usage: _format_output(is_inputs_tuple, output) and returns: unknown