def __eq__(self, other):
        return (isinstance(other, self.__class__) and
                other.package == self.package)
def badmatch(match, badfn):
    """Make a copy of the given matcher, replacing its bad method with the given
    one.
    """
    m = copy.copy(match)
    m.bad = badfn
    return m