<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def plotLoss(self, filename=None):
 """ Plots the loss history. :param filename (string) Can be provided to save the figure """

    plt.figure()
    plt.plot(self.losses.keys(), self.losses.values())
    plt.xlabel("Iteration")
    plt.ylabel("Loss")
    plt.title("Learning curve for {}".format(self))

    if filename is not None:
      plt.savefig(filename)