'Fail if there are instances of theClass in theList with given params'

def failIfContainsInstanceOf(self, theClass, params, theList, msg=None):

    self.failIfNoMessage(theList)
    for item in theList:
        if ((theClass == Message) and isinstance(item, SelfDoesntMatchLocation)):
            continue
        if ((theClass == Message) and isinstance(item, MissingSelf)):
            continue
        if issubclass(item.__class__, theClass):
            if (not params):
                raise self.failureException, (msg or ('unexpected    %s' % theClass.__name__))
            allmatch = 1
            for (k, v) in params.items():
                if (item.params[k] != v):
                    allmatch = 0
            if allmatch:
                raise self.failureException, ('unexpected    %s.%s    with    a    value    of    %s' % (theClass.__name__, k, v))
