code: def to_json(value, **kwargs):
          
          if isinstance(value, HasProperties):
              return value.serialize(**kwargs)
          return value
docs: Return value, serialized if value is a HasProperties instance