code: def _iterate_object(obj):
      
      d = {}
      try:
          d = vars(obj)
      except TypeError:
          # maybe we have named tuple here?
          if hasattr(obj, '_asdict'):
              d = obj._asdict()
      for item in iteritems(d):
          yield item
      try:
          slots = obj.__slots__
      except AttributeError:
          pass
      else:
          for key in slots:
              if key != '__dict__':
                  yield (key, getattr(obj, key))
docs: Return iterator over object attributes. Respect objects with
      defined __slots__.