code: def _assert_and_get_length_recursively(obj):
      if isinstance(obj, (list, tuple)):
          lengths = [_assert_and_get_length_recursively(o) for o in obj]
          for length in lengths[1:]:
              assert length == lengths[0]
          return lengths[0]
      return len(obj)
  
imports: import contextlib
  import numbers
  import os
  import random
  import warnings
  from typing import IO, Any, BinaryIO, Optional, Union
  import numpy
  import torch
  from torch.nn.utils.rnn import PackedSequence
  from torch.utils.data import Dataset
  from poutyne.warning_manager import warning_settings
label_desc: Use image node_id 7 for calling a global function with example usage: _assert_and_get_length_recursively(obj) and returns: len, lengths