Remove filter with the given name from a cyvcf2 record

def cyvcf_remove_filter(rec, name):
    """Remove filter with the given name from a cyvcf2 record
    """
    if rec.FILTER:
        filters = rec.FILTER.split(";")
    else:
        filters = []
    new_filters = [x for x in filters if not str(x) == name]
    if len(new_filters) == 0:
        new_filters = ["PASS"]
    rec.FILTER = new_filters
    return rec