code: def check_list_groups(list_groups, input_dim):
      """
      Check that list groups:
          - is a list of list
          - does not contain twice the same feature in different groups
          - does not contain unknown features (>= input_dim)
          - does not contain empty groups
      Parameters
      ----------
      - list_groups : list of list of int
          Each element is a list representing features in the same group.
          One feature should appear in maximum one group.
          Feature that don't get assign a group will be in their own group of one feature.
      - input_dim : number of feature in the initial dataset
      """
      assert isinstance(
          list_groups, list
      ), "list_groups must be a list of list."
  
      if len(list_groups) == 0:
          return
      else:
          for group_pos, group in enumerate(list_groups):
              msg = f"Groups must be given as a list of list, but found {group} in position {group_pos}."  # noqa
              assert isinstance(group, list), msg
              assert (
                  len(group) > 0
              ), "Empty groups are forbidding please remove empty groups []"
  
      n_elements_in_groups = np.sum(
          [len(group) for group in list_groups]
      )
      flat_list = []
      for group in list_groups:
          flat_list.extend(group)
      unique_elements = np.unique(flat_list)
      n_unique_elements_in_groups = len(unique_elements)
      msg = f"One feature can only appear in one group, please check your grouped_features."
      assert n_unique_elements_in_groups == n_elements_in_groups, msg
  
      highest_feat = np.max(unique_elements)
      assert (
          highest_feat < input_dim
      ), f"Number of features is {input_dim} but one group contains {highest_feat}."  # noqa
      return
  
imports: from torch.utils.data import Dataset
  from torch.utils.data import DataLoader, WeightedRandomSampler
  import torch
  import numpy
  import scipy
  import json
  from sklearn.utils import check_array
  import pandas
  import warnings
label_desc: Use image node_id 5 for calling a global function with example usage: check_list_groups(list_groups, input_dim) without return types