def _stacked_observation(self, obs):
        '''
        Assumes self._history contains the last n frames from the environment
        Concatenates the frames together along the depth axis
        '''
        #stacked_obs_dict_unordered = collections.OrderedDict()
        #stacked_obs_dict_unordered['pixel'] = collections.OrderedDict()
        new_pixel_modality = collections.OrderedDict()

        for key in obs['pixel']:
            obs_stacked = []
            for history_obs in self._history:
                obs_stacked.append(history_obs['pixel'][key])
            assert len(obs_stacked) <= self.n
            if self.frame_stack_concatenate_on_env:
                stacked = np.concatenate(obs_stacked, axis=0)
            else:
                stacked = obs_stacked
            #stacked_obs_dict_unordered['pixel'][key] = stacked
            new_pixel_modality[key] = stacked
        next_stacked_dict = collections.OrderedDict()
        for key in obs:
            if key == 'pixel':
                next_stacked_dict[key] = new_pixel_modality
            else:
                next_stacked_dict[key] = obs[key]
        return next_stacked_dict

        Assumes self._history contains the last n frames from the environment
        Concatenates the frames together along the depth axis
        
surreal/env/wrapper.py