def _batch_obs(self, traj_list):
        '''
            Helper function that batches a list of observation (nested dictionary)
            into one whole dictionary of batched observation
            Args:
                traj_list: list of nested observation
        '''
        batched_obs = {}
        for modality in self.obs_spec.keys():
            batched_obs[modality] = {}
            for key in self.obs_spec[modality].keys():
                batched_obs[modality][key] = []
                for exp in traj_list: # exp ~= ex['obs']
                    n_step_obs = []
                    for obs in exp: 
                        n_step_obs.append(obs[modality][key])
                    n_step_obs = np.stack(n_step_obs)
                    batched_obs[modality][key].append(n_step_obs)
                batched_obs[modality][key] = np.stack(batched_obs[modality][key])
        return batched_obs

            Helper function that batches a list of observation (nested dictionary)
            into one whole dictionary of batched observation
            Args:
                traj_list: list of nested observation
        
surreal/learner/aggregator.py