code: def _flatten_struct(seg_out):
      dict_keys = None
      seg_probs: tuple[torch.Tensor, ...]
      if isinstance(seg_out, torch.Tensor):
          seg_probs = (seg_out,)
      elif isinstance(seg_out, Mapping):
          dict_keys = sorted(
              seg_out.keys()
          )  # track predictor's output keys
          seg_probs = tuple(seg_out[k] for k in dict_keys)
      else:
          seg_probs = ensure_tuple(seg_out)
      return dict_keys, seg_probs
  
file_path: MONAI/monai/inferers/utils.py
imports: from __future__ import annotations
  import itertools
  from collections.abc import Callable, Mapping, Sequence
  from typing import Any, Iterable
  import numpy
  import torch
  import torch.nn.functional
  from monai.data.meta_tensor import MetaTensor
  from monai.data.utils import compute_importance_map, dense_patch_slices, get_valid_patch_size
  from monai.utils import BlendMode, PytorchPadMode, convert_data_type, convert_to_dst_type, ensure_tuple, ensure_tuple_rep, fall_back_tuple, look_up_option, optional_import, pytorch_after
label_desc: Use image node_id 5 for calling a global function with example usage: _flatten_struct(seg_out) and returns: dict_keys,  seg_probs