code: def jsonify_r(obj):  # pragma: no cover, not for unit tests...
      # pylint: disable=too-many-branches
      
      res = {}
      cls = obj.__class__
      if not hasattr(cls, 'properties'):
          try:
              json.dumps(obj)
              return obj
          except TypeError:
              return None
      properties = list(cls.properties.keys())
      if hasattr(cls, 'running_properties'):
          properties += list(cls.running_properties.keys())
      for prop in properties:
          if not hasattr(obj, prop):
              continue
          val = getattr(obj, prop)
          # Maybe the property is not jsonable
          try:
              if isinstance(val, set):
                  val = list(val)
              if isinstance(val, list):
                  val = sorted(val)
              json.dumps(val)
              res[prop] = val
          except TypeError:
              if isinstance(val, list):
                  lst = []
                  for subval in val:
                      o_type = getattr(subval.__class__, 'my_type', '')
                      if o_type == 'CommandCall':
                          try:
                              lst.append(subval.call)
                          except AttributeError:  # pragma: no cover, should not happen...
                              pass
                          continue
                      if o_type and hasattr(subval, o_type + '_name'):
                          lst.append(getattr(subval, o_type + '_name'))
                      else:
                          pass
                  res[prop] = lst
              else:
                  o_type = getattr(val.__class__, 'my_type', '')
                  if o_type == 'CommandCall':
                      try:
                          res[prop] = val.call
                      except AttributeError:  # pragma: no cover, should not happen...
                          pass
                      continue
                  if o_type and hasattr(val, o_type + '_name'):
                      res[prop] = getattr(val, o_type + '_name')
      return res
docs: Convert an object into json (recursively on attribute)
  
      :param obj: obj to jsonify
      :type obj: object
      :return: json representation of obj
      :rtype: dict