code: def relate_obs_ids_to_chosen_alts(obs_id_array,
                                    alt_id_array,
                                    choice_array):
      chosen_alts_to_obs_ids = {}
      for alt_id in np.sort(np.unique(alt_id_array)):
          selection_condition =\
              np.where((alt_id_array == alt_id) & (choice_array == 1))
          chosen_alts_to_obs_ids[alt_id] =\
              np.sort(np.unique(obs_id_array[selection_condition]))
      return chosen_alts_to_obs_ids