def getBaseClasses(obj, includeSelf=False, includeObject=True):
    """
    Get all base classes from an object's class.

    :param any obj: Generic obj or class
    :param includeSelf: Whether to include own class or not
    :param includeObject: Whether to include object class or not (Every object has object as base)
    :return: List of classes
    :rtype: list[type]
    """
    if isinstance(obj, type):
        cls = obj
    else:
        cls = obj.__class__

    classes = list(cls.__bases__)
    for base in classes:
        for baseClassBase in getBaseClasses(base):
            if baseClassBase not in classes:
                classes.append(baseClassBase)

    if includeSelf:
        classes.insert(0, cls)

    if not includeObject:
        classes.remove(object)

    return classes