<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def to_dict(obj):
 """ Create a filtered dict from the given object. Note: This function is currently specific to the FailureLine model. """

    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}