code: def calc_pA_info_gain(pA, qo_pi, qs_pi):
      """
      Compute expected Dirichlet information gain about parameters ``pA`` under a policy
  
      Parameters
      ----------
      pA: ``numpy.ndarray`` of dtype object
          Dirichlet parameters over observation model (same shape as ``A``)
      qo_pi: ``list`` of ``numpy.ndarray`` of dtype object
          Predictive posterior beliefs over observations expected under the policy, where ``qo_pi[t]`` stores the beliefs about
          observations expected under the policy at time ``t``
      qs_pi: ``list`` of ``numpy.ndarray`` of dtype object
          Predictive posterior beliefs over hidden states expected under the policy, where ``qs_pi[t]`` stores the beliefs about
          hidden states expected under the policy at time ``t``
  
      Returns
      -------
      infogain_pA: float
          Surprise (about Dirichlet parameters) expected under the policy in question
      """
  
      n_steps = len(qo_pi)
  
      num_modalities = len(pA)
      wA = utils.obj_array(num_modalities)
      for modality, pA_m in enumerate(pA):
          wA[modality] = spm_wnorm(pA[modality])
  
      pA_infogain = 0
  
      for modality in range(num_modalities):
          wA_modality = wA[modality] * (pA[modality] > 0).astype(
              "float"
          )
          for t in range(n_steps):
              pA_infogain -= qo_pi[t][modality].dot(
                  spm_dot(wA_modality, qs_pi[t])[:, np.newaxis]
              )
  
      return pA_infogain
  
imports: import itertools
  import numpy
  from pymdp.maths import softmax, softmax_obj_arr, spm_dot, spm_wnorm, spm_MDP_G, spm_log_single, spm_log_obj_array
  from pymdp import utils
  import copy
label_desc: Use image node_id 7 for calling a global function with example usage: calc_pA_info_gain(pA, qo_pi, qs_pi) and returns: pA_infogain