def variant_is_good_to_keep(cur, g, log):
    """Check that the currently selected variant is good to keep.

    When this is called, it's after parsing the summary statistics and when
    looking up variants in the reference panel.

    This means that the filters being applied are:

    - Reference panel MAF filtering
    - Filters based on the availability in reference panels
    - Filters based on multiallelic / duplicates in reference panel

    """
    if len(g) == 0:
        if log.parameters['EXCLUDE_NO_REFERENCE']:
            log.record_excluded(cur, 'NOT_IN_REFERENCE_PANEL')
            return False
        else:
            log.record_included_special(cur, 'NOT_IN_REFERENCE',
                'Variant {} was absent from the reference panel but was still included in the GRS. It is important to validate that it is not correlated with other included variants.'
                .format(cur))
            return True
    elif len(g) == 1:
        maf = g[0].maf()
        if maf <= log.parameters['MAF_THRESHOLD']:
            log.record_excluded(cur, 'MAF_FILTER',
                'MAF from reference panel is {:g}'.format(maf))
            return False
    elif len(g) > 1:
        log.record_excluded(cur, 'DUP_OR_MULTIALLELIC_IN_REFERENCE_PANEL')
        return False
    return True
