<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def remove(self, tag, nth=1):
 """Remove the n-th occurrence of tag in this message. :param tag: FIX field tag number to be removed. :param nth: Index of tag if repeating, first is 1. :returns: Value of the field if removed, None otherwise."""


        tag = fix_tag(tag)
        nth = int(nth)

        for i in range(len(self.pairs)):
            t, v = self.pairs[i]
            if t == tag:
                nth -= 1
                if nth == 0:
                    self.pairs.pop(i)
                    return v

        return None