code: def as_object(obj):
      
      LOGGER.debug('as_object(%s)', obj)
  
      if isinstance(obj, datetime.date):
          return as_date(obj)
  
      elif hasattr(obj, '__dict__'):
  
          # populate dict with visible attributes
          out = {k: obj.__dict__[k] for k in obj.__dict__ if not k.startswith('_')}
  
          # populate dict with property names and values
          for k, v in (
                  (p, getattr(obj, p))
                  for p, _ in inspect.getmembers(
                      obj.__class__,
                      lambda x: isinstance(x, property))
          ):
              out[k] = v
  
          return out
docs: Return a JSON serializable type for ``o``.
  
      Args:
          obj (:py:class:`object`): the object to be serialized.
  
      Raises:
          :py:class:`AttributeError`:
              when ``o`` is not a Python object.
  
      Returns:
          (dict): JSON serializable type for the given object.