<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_spectra_pieces_pdf(ss, aint=10, pdf_filename='pieces.pdf', setup=_default_setup):
 """ Plots spectra, overlapped, in small wavelength intervals into a PDF file, one interval per page of the PDF file. Args: ss: list of Spectrum objects aint: wavelength interval for each plot pdf_filename: name of output file setup: PlotSpectrumSetup object **Note** overrides setup.fmt_xlabel; leaves y-labell and title blank """


    import f311.explorer as ex

    xmin, xmax, ymin_, ymax, _, yspan = calc_max_min(ss)
    ymin = ymin_ if setup.ymin is None else setup.ymin

    num_pages = int(math.ceil((xmax-xmin)/aint)) # rightmost point may be left out...or not
    # num_spectra = len(ss)

    a99.format_BLB()
    # pdf = matplotlib.backends.backend_pdf.PdfPages(pdf_filename)
    pdf = matplotlib.backends.backend_pdf.PdfPages(pdf_filename)
    logger = a99.get_python_logger()

    for h in range(num_pages):
        fig = plt.figure()
        lambda0 = xmin+h*aint
        lambda1 = lambda0+aint
        logger.info("Printing page {0:d}/{1:d} ([{2:g}, {3:g}])".format(h+1, num_pages, lambda0, lambda1))
        for i, s in enumerate(ss):
            s_cut = ex.cut_spectrum(s, lambda0, lambda1)
            ax = plt.gca()
            ax.plot(s_cut.x, s_cut.y, label=s.title)
        if setup.flag_xlabel and setup.fmt_xlabel:
            plt.xlabel('Wavelength (interval: [{0:g}, {1:g}])'.format(lambda0, lambda1))
        xspan = lambda1-lambda0
        ax.set_xlim([lambda0 - xspan * _T, lambda1 + xspan * _T])
        ax.set_ylim([ymin - yspan * _T, ymax + yspan * _T])
        if setup.flag_legend:
            leg = plt.legend(loc=0)
            a99.format_legend(leg)
        plt.tight_layout()
        pdf.savefig(fig)
        plt.close()

    # for fig in xrange(1, figure().number): ## will open an empty extra figure :(
    #     pdf.savefig( fig )
    pdf.close()
    logger.info("File {0!s} successfully created.".format(pdf_filename))