def get_qual_name(o, lower=False):
    """
    Returns the qualified name of an object o.
    """
    if not isinstance(o, type):
        o = o.__class__
    if lower:
        return o.__qualname__.lower()
    else:
        return o.__qualname__