def generate_single_kcorrection_polynomial(
        log,
        model,
        pathToOutputDirectory,
        redshift,
        ffilter,
        restFrameFilter,
        kCorPolyOrder=3,
        kCorMinimumDataPoints=3,
        plot=False):
    """
    *Given a the k-correction lightcurve, convert it to a polynomial, plot if requested and dump to a separate file.*

    **Key Arguments:**
        - ``log`` -- logger
        - ``model`` -- the transient model name
        - ``pathToOutputDirectory`` -- path to the output directory (provided by the user)
        - ``redshift`` -- the redshift of the k-correction listing to plot
        - ``ffilter`` -- the k-correction rest frame filter
        - ``restFrameFilter`` -- the observed frame filter
        - ``kCorPolyOrder`` -- the order of the polynomial to fit
        - ``kCorMinimumDataPoints`` -- Minimum number of datapoints used to generate k-correction curve
        - ``plot`` -- plot the polynomial?

    **Return:**
        - None
    """
    ################ > IMPORTS ################
    ## STANDARD LIB ##
    ## THIRD PARTY ##
    import numpy as np
    import yaml
    ## LOCAL APPLICATION ##
    import dryxPython.plotting as dp

    ################ >ACTION(S) ################
    strRed = "%0.3f" % (redshift,)
    dataDir = pathToOutputDirectory + "/k_corrections/%s/%s" % (model, ffilter)
    pathToYaml = dataDir + "/z" + str(strRed).replace(".", "pt") + ".yaml"
    fileName = pathToYaml
    stream = file(fileName, 'r')
    yamlList = yaml.load(stream)
    thisKcor = 'K_%s%s' % (restFrameFilter, ffilter)
    stream.close()

    kCor = []
    time = []

    if not yamlList:
        return

    try:
        log.debug(
            "attempting to generate a k-correction polynomial plot from the file: %s" %
            (fileName,))
        for item in yamlList:
            kCor.append(item[thisKcor])
            time.append(item['Rest Frame Days'])
    except Exception as e:
        log.warning(
            "could not generate a k-correction polynomial plot from the file %s:  - failed with this error: %s " %
            (fileName, str(e),))
        return -1

    if len(kCor) < kCorMinimumDataPoints:
        basename = os.path.basename(fileName)
        log.warning(
            'the k-correction file %s contains less than %s datapoints to convert from %s restframe to %s observed frame for the %s model - polynomial shall not be generated' %
            (basename, kCorMinimumDataPoints, restFrameFilter, ffilter, model))
        return

    kCorArray = np.array(kCor)
    timeArray = np.array(time)
    xMin = np.min(timeArray)
    xMax = np.max(timeArray)

    timeDist = 50
    timeDelta = 40
    for i in range(4):
        timeArray = np.append(timeArray, xMin - timeDist - i * timeDelta)
        timeArray = np.append(timeArray, xMax + timeDist + i * timeDelta)
        kCorArray = np.append(kCorArray, [0, 0])

    log.debug('timeArray: %s' % (timeArray,))
    log.debug('kCorArray: %s' % (kCorArray,))

    expand = 150
    xMin -= expand
    xMax += expand

    thisPoly = np.polyfit(timeArray, kCorArray, kCorPolyOrder)
    flatPoly = np.poly1d(thisPoly)
    polyDict = {}
    dataDict = {}
    polyDict[redshift] = flatPoly
    dataDict[redshift] = [timeArray, kCorArray]

    title = "k_%s%s at z = %s" % (restFrameFilter, ffilter, redshift)

    if plot:
        fileName = plot_polynomial(
            log,
            title=title,
            polynomialDict=polyDict,
            orginalDataDictionary=dataDict,
            pathToOutputPlotsFolder=dataDir + "/",
            xRange=[xMin, xMax],
            xAxisLimits=[xMin + 100, xMax - 100],
            yAxisLimits=[-5, 5],
            yAxisInvert=False,
            prependNum=False)

        # mdLog.write("""![%s_plot]\n\n[%s_plot]: %s\n\n""" % (title.replace(" ", "_"), title.replace(" ", "_"), fileName,))

    newFileName = dataDir + "/z" + \
        str(strRed).replace(".", "pt") + "_poly.yaml"
    stream = file(newFileName, 'w')
    yamlContent = {'polyCoeffs': flatPoly.coeffs}
    #log.debug('flatPoly.coeffs %s' % (flatPoly.coeffs,))
    yaml.dump(yamlContent, stream, default_flow_style=True)
    stream.close()

    return