<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def find(self, qref, classes=[], ignore=None):
 """ Find a referenced type in self or children. Return None if not found. Qualified references for all schema objects checked in this search will be added to the set of ignored qualified references to avoid the find operation going into an infinite loop in case of recursively defined structures. @param qref: A qualified reference. @type qref: qref @param classes: A collection of classes used to qualify the match. @param ignore: A set of qualified references to ignore in this search. @return: The referenced type. @rtype: L{SchemaObject} @see: L{qualify()} """

        if not len(classes):
            classes = (self.__class__,)
        if ignore is None:
            ignore = set()
        if self.qname in ignore:
            return
        ignore.add(self.qname)
        if self.qname == qref and self.__class__ in classes:
            return self
        for c in self.rawchildren:
            p = c.find(qref, classes, ignore=ignore)
            if p is not None:
                return p