def getInstanceVarNames(obj):
    """Return a list the names of all (potential) instance variables."""
    slots = {}
    if hasattr(obj, '__dict__'):
        slots.update(obj.__dict__)
    if hasattr(obj, '__class__'):
        slots['__class__'] = 1
    cls = getattr(obj, '__class__', type(obj))
    if hasattr(cls, '__mro__'):
        for base in cls.__mro__:
            for name, value in base.__dict__.items():
                if hasattr(value, '__get__') and not callable(value
                    ) and hasattr(obj, name):
                    slots[name] = 1
    if '__dict__' in slots:
        del slots['__dict__']
    slots = sorted(slots.keys())
    return slots
