code: def to_dict(obj):
      
      if not isinstance(obj.test, str):
          # TODO: can we handle this in the DB?
          # Reftests used to use tuple indicies, which we can't support.
          # This is fixed upstream, but we also need to handle it here to allow
          # for older branches.
          return
  
      keys = [
          'id',
          'job_guid',
          'test',
          'subtest',
          'status',
          'expected',
          'message',
          'best_classification',
          'best_is_verified',
      ]
  
      all_fields = obj.to_dict()
      return {k: v for k, v in all_fields.items() if k in keys}
docs: Create a filtered dict from the given object.
  
      Note: This function is currently specific to the FailureLine model.