code: def get_attrs(obj):
      
      if not hasattr(obj, '__dict__'):
          return []  # slots only
      proxy_type = types.MappingProxyType if six.PY3 else types.DictProxyType
      if not isinstance(obj.__dict__, (dict, proxy_type)):
          print(type(obj.__dict__), obj)
          raise TypeError("%s.__dict__ is not a dictionary" % obj.__name__)
      return obj.__dict__.keys()
docs: Helper for dir2 implementation.