code: def dir2(obj):
      
      attrs = set()
  
      if not hasattr(obj, '__bases__'):
          # obj is an instance
          if not hasattr(obj, '__class__'):
              # slots
              return sorted(get_attrs(obj))
          klass = obj.__class__
          attrs.update(get_attrs(klass))
      else:
          # obj is a class
          klass = obj
  
      for cls in klass.__bases__:
          attrs.update(get_attrs(cls))
          attrs.update(dir2(cls))
      attrs.update(get_attrs(obj))
      return list(attrs)
docs: Default dir implementation.
  
      Inspired by gist: katyukha/dirmixin.py
      https://gist.github.com/katyukha/c6e5e2b829e247c9b009