def perform_biopsy_site_type_filtering(maf_df, cli_df, filter_type):
    """Keep only samples in clinical_df in which the sample's Biopsy_Site_Type matches
    the specified filter.

    Notes
    -----
    - If filter_type is "PRIMARY_ONLY", then keep only samples with
     "PRIMARY" biopsy_site_type.
    """

    if filter_type == "PRIMARY_ONLY":
        keep_samples = set(cli_df[cli_df['Biopsy_Site_Type'] == "Primary"]['Tumor_Sample_Barcode'].unique())

        cli_df = cli_df[cli_df['Tumor_Sample_Barcode'].isin(keep_samples)]
        maf_df = maf_df[maf_df['Tumor_Sample_Barcode'].isin(keep_samples)]

    else:
        raise Exception("Invalid filter_type: %s" % filter_type)

    return maf_df, cli_df