code: def object_to_items(data_structure):
      
      items = []
      # Get all items from dict
      try:
          items = list(data_structure.__dict__.items())
      except:
          pass
      # Get all slots
      hierarchy = [data_structure]
      try:
          hierarchy += inspect.getmro(data_structure)
      except:
          pass
      slots = []
      try:
          for b in hierarchy:
              try:
                  slots += b.__slots__
              except:  # pragma: no cover
                  pass
      except:  # pragma: no cover
          pass
      # Get attrs from slots
      for x in slots:
          items.append((x, getattr(data_structure, x)))
      return items
docs: Converts a object to a items list respecting also slots.
  
      Use dict(object_to_items(obj)) to get a dictionary.