code: def update_dict(obj, dict, attributes):
      
      for attribute in attributes:
          if hasattr(obj, attribute) and getattr(obj, attribute) is not None:
              dict[attribute] = getattr(obj, attribute)
docs: Update dict with fields from obj.attributes.
  
      :param obj: the object updated into dict
      :param dict: the result dictionary
      :param attributes: a list of attributes belonging to obj