code: def get_model_dimensions_from_labels(model_labels):
      modalities = model_labels["observations"]
      num_modalities = len(modalities.keys())
      num_obs = [
          len(modalities[modality]) for modality in modalities.keys()
      ]
  
      factors = model_labels["states"]
      num_factors = len(factors.keys())
      num_states = [len(factors[factor]) for factor in factors.keys()]
  
      if "actions" in model_labels.keys():
          controls = model_labels["actions"]
          num_control_fac = len(controls.keys())
          num_controls = [
              len(controls[cfac]) for cfac in controls.keys()
          ]
  
          return (
              num_obs,
              num_modalities,
              num_states,
              num_factors,
              num_controls,
              num_control_fac,
          )
      else:
          return num_obs, num_modalities, num_states, num_factors
  
imports: import numpy
  import pandas
  import seaborn
  import matplotlib.pyplot
  import warnings
  import itertools
label_desc: Use image node_id 16 for calling a global function with example usage: get_model_dimensions_from_labels(model_labels) and returns: num_obs,  num_modalities,  num_states,  num_factors,  num_controls,  num_control_fac, num_obs,  num_modalities,  num_states,  num_factors