code: def apply_aggregate(shared_response, aggregate, input_format):
      if aggregate is None:
          if input_format == "list_of_array":
              return [np.mean(shared_response, axis=0)]
          else:
              return [
                  np.mean(
                      [
                          shared_response[i][j]
                          for i in range(len(shared_response))
                      ],
                      axis=0,
                  )
                  for j in range(len(shared_response[0]))
              ]
      else:
          if input_format == "list_of_array":
              return [shared_response]
          else:
              return shared_response
  
imports: import os
  import tempfile
  import numpy
  import pytest
  from numpy.testing import assert_array_almost_equal
  from sklearn.exceptions import NotFittedError
  from brainiak.funcalign.fastsrm import FastSRM, _compute_and_save_corr_mat, _compute_and_save_subject_basis, _compute_basis_subject_online, _reduced_space_compute_shared_response, check_atlas, check_imgs, check_shared_response, create_temp_dir, fast_srm, reduce_data, safe_load
  from brainiak.funcalign.srm import DetSRM
label_desc: Use image node_id 13 for calling a global function with example usage: apply_aggregate(shared_response, aggregate, input_format) and returns: list, unknown, list, shared_response