code: def convert_A_stub_to_ndarray(A_stub, model_labels):
      """
      This function converts a multi-index pandas dataframe `A_stub` into an object array of different
      A matrices, one per observation modality.
      """
  
      (
          num_obs,
          num_modalities,
          num_states,
          num_factors,
      ) = get_model_dimensions_from_labels(model_labels)
  
      A = obj_array(num_modalities)
  
      for g, modality_name in enumerate(
          model_labels["observations"].keys()
      ):
          A[g] = (
              A_stub.loc[modality_name]
              .to_numpy()
              .reshape(num_obs[g], *num_states)
          )
          assert (
              A[g].sum(axis=0) == 1.0
          ).all(), (
              "A matrix not normalized! Check your initialization....\n"
          )
  
      return A
  
imports: import numpy
  import pandas
  import seaborn
  import matplotlib.pyplot
  import warnings
  import itertools
label_desc: Use image node_id 33 for calling a global function with example usage: convert_A_stub_to_ndarray(A_stub, model_labels) and returns: A