code: def _get_array_dicts(templates, stream, copy_streams=True):
      
      # Do some reshaping
      # init empty structures for data storage
      template_dict = {}
      stream_dict = {}
      pad_dict = {}
      t_starts = []
  
      stream.sort(['network', 'station', 'location', 'channel'])
      for template in templates:
          template.sort(['network', 'station', 'location', 'channel'])
          t_starts.append(min([tr.stats.starttime for tr in template]))
      # get seed ids, make sure these are collected on sorted streams
      seed_ids = [tr.id + '_' + str(i) for i, tr in enumerate(templates[0])]
      # pull common channels out of streams and templates and put in dicts
      for i, seed_id in enumerate(seed_ids):
          temps_with_seed = [template[i].data for template in templates]
          t_ar = np.array(temps_with_seed).astype(np.float32)
          template_dict.update({seed_id: t_ar})
          stream_dict.update(
              {seed_id: stream.select(
                  id=seed_id.split('_')[0])[0].data.astype(np.float32)})
          pad_list = [
              int(round(template[i].stats.sampling_rate *
                        (template[i].stats.starttime - t_starts[j])))
              for j, template in zip(range(len(templates)), templates)]
          pad_dict.update({seed_id: pad_list})
  
      return stream_dict, template_dict, pad_dict, seed_ids
docs: prepare templates and stream, return dicts