docs: def attr_to_dict(obj, attr, dct):
      """
      Add attribute to dict if it exists.
      :param dct:
      :param obj: object
      :param attr: object attribute name
      :return:  dict
      """
      if hasattr(obj, attr):
          dct[attr] = getattr(obj, attr)
      return dct