code: def contract_to_dict(contract):
      
      default = Contract()
      return {field: val for field, val in vars(contract).items() if val != getattr(default, field, None)}
docs: Convert an IBPy Contract object to a dict containing any non-default values.