Looks up the ancestor of the inputed QObject based on the given class type.
    
    :param      qobject   | <QObject>
                classType | <subclass of QObject> || <str>
    
    :return     <subclass of QObject> || None

def ancestor(qobject, classType):
    """
    Looks up the ancestor of the inputed QObject based on the given class type.
    
    :param      qobject   | <QObject>
                classType | <subclass of QObject> || <str>
    
    :return     <subclass of QObject> || None
    """
    parent = qobject
    is_class = True
    while parent:
        if type(parent).__name__ == classType:
            return parent
        
        if is_class:
            try:
                if isinstance(parent, classType):
                    return parent
            except TypeError:
                is_class = False
        
        parent = parent.parent()
    
    return None