<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def public_pairs_for_script(self, tx, tx_in_idx, generator):
 """ For a given script, iterate over and pull out public pairs encoded as sec values. """

        public_pairs = []
        for sec in self.extract_secs(tx, tx_in_idx):
            try:
                public_pairs.append(sec_to_public_pair(sec, generator))
            except EncodingError:
                pass
        return public_pairs