<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def getopt(self, p, default=None):
 """Returns the first option value stored that matches p or default."""

        for k, v in self.pairs:
            if k == p:
                return v
        return default