<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _fix_mutation_df(mutation_df, only_unique=False):
 """Drops invalid mutations and corrects for 1-based coordinates. TODO: Be smarter about what coordinate system is put in the provided mutations. Parameters mutation_df : pd.DataFrame user provided mutations only_unique : bool flag indicating whether only unique mutations for each tumor sample should be kept. This avoids issues when the same mutation has duplicate reportings. Returns ------- mutation_df : pd.DataFrame mutations filtered for being valid and correct mutation type. Also converted 1-base coordinates to 0-based. """

    # only keep allowed mutation types
    orig_len = len(mutation_df)  # number of mutations before filtering
    mutation_df = mutation_df[mutation_df.Variant_Classification.isin(variant_snv)]  # only keep SNV
    type_len = len(mutation_df)  # number of mutations after filtering based on mut type

    # log the number of dropped mutations
    log_msg = ('Dropped {num_dropped} mutations after only keeping '
               '{mut_types}. Indels are processed separately.'.format(num_dropped=orig_len-type_len,
                                                                      mut_types=', '.join(variant_snv)))
    logger.info(log_msg)

    # check if mutations are valid SNVs
    valid_nuc_flag = (mutation_df['Reference_Allele'].apply(is_valid_nuc) & \
                      mutation_df['Tumor_Allele'].apply(is_valid_nuc))
    mutation_df = mutation_df[valid_nuc_flag]  # filter bad lines
    mutation_df = mutation_df[mutation_df['Tumor_Allele'].apply(lambda x: len(x)==1)]
    mutation_df = mutation_df[mutation_df['Reference_Allele'].apply(lambda x: len(x)==1)]
    valid_len = len(mutation_df)

    # log the number of dropped mutations
    log_msg = ('Dropped {num_dropped} mutations after only keeping '
               'valid SNVs'.format(num_dropped=type_len-valid_len))
    logger.info(log_msg)

    # drop duplicate mutations
    if only_unique:
        dup_cols = ['Tumor_Sample', 'Chromosome', 'Start_Position',
                    'End_Position', 'Reference_Allele', 'Tumor_Allele']
        mutation_df = mutation_df.drop_duplicates(subset=dup_cols)

        # log results of de-duplication
        dedup_len = len(mutation_df)
        log_msg = ('Dropped {num_dropped} mutations when removing '
                   'duplicates'.format(num_dropped=valid_len-dedup_len))
        logger.info(log_msg)

    # add dummy Protein_Change or Tumor_Type columns if not provided
    # in file
    if 'Tumor_Type' not in mutation_df.columns:
        mutation_df['Tumor_Type'] = ''
    if 'Protein_Change' not in mutation_df.columns:
        mutation_df['Protein_Change'] = ''

    # correct for 1-based coordinates
    mutation_df['Start_Position'] = mutation_df['Start_Position'].astype(int) - 1
    return mutation_df