<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def plotCost(cost_list, output=None):
 """Plot cost function Plot the final cost function Parameters cost_list : list List of cost function values output : str, optional Output file name """


    if not import_fail:

        if isinstance(output, type(None)):
            file_name = 'cost_function.png'
        else:
            file_name = output + '_cost_function.png'

        plt.figure()
        plt.plot(np.log10(cost_list), 'r-')
        plt.title('Cost Function')
        plt.xlabel('Iteration')
        plt.ylabel(r'$\log_{10}$ Cost')
        plt.savefig(file_name)
        plt.close()

        print(' - Saving cost function data to:', file_name)

    else:

        warn('Matplotlib not installed.')