<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _plot_generic(self, filename=None):
 """Plots the current state of the shell, saving the value to the specified file if specified. """

        #Since the filename is being passed directly from the argument, check its validity.
        if filename == "":
            filename = None

        if "x" not in self.curargs["labels"]:
            #Set a default x-label since we know what variable is being plotted.
            self.curargs["labels"]["x"] = "Value of '{}' (unknown units)".format(self.curargs["independent"])
        args = self.curargs
        a = self.tests[self.active]
        self._make_fits()
        
        #Before we can pass the markers in, we need to translate from keys to values so
        #that matplotlib understands.
        markdict = self._get_matplot_dict("markers", "marker", self._possible_markers)
        linedict = self._get_matplot_dict("lines", "style", self._possible_linestyles)

        #Set the remaining arguments to have the right keyword name.
        args["savefile"] = filename
        args["markers"] = markdict
        args["lines"] = linedict
        
        a.plot(**args)