<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def filter(self, other):
 """ Throw away those options which are not in the other one. Returns a new instance with the rejected options. """


        self.canonify()
        other.canonify()

        rej = self.__class__()
        rej.optlist = self.optlist.difference(other.optlist)
        self.optlist.difference_update(rej.optlist)
        for x in self.optdict.copy():
             if x not in other.optdict:
                 self.optdict.pop(x)
                 rej.optdict[x] = None

        return rej