Vanilla implementation of built-in dir() for PY2 to help with overriding __dir__.
    Based on implementation of dir() in pypy.

def instance_dir(obj):  # pragma: py3 no cover
    """Vanilla implementation of built-in dir() for PY2 to help with overriding __dir__.
    Based on implementation of dir() in pypy."""
    d = dict()
    d.update(obj.__dict__)
    d.update(class_dir(obj.__class__))
    result = sorted(d.keys())
    return result