<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def append_dims_and_file_extension(fname, data_df):
 """Append dimensions and file extension to output filename. N.B. Dimensions are cols x rows. Args: fname (string):
 output filename data_df (pandas df) Returns: out_fname (string):
 output filename with matrix dims and .gct appended """

    # If there's no .gct at the end of output file name, add the dims and .gct
    if not fname.endswith(".gct"):
        out_fname = '{0}_n{1}x{2}.gct'.format(fname, data_df.shape[1], data_df.shape[0])
        return out_fname

    # Otherwise, only add the dims
    else:
        basename = os.path.splitext(fname)[0]
        out_fname = '{0}_n{1}x{2}.gct'.format(basename, data_df.shape[1], data_df.shape[0])
        return out_fname