Align the values of an isotope impurity matrix and fill up with 0.

    NOTE:
        The length of the rows in the "matrix" must be the sum of "preChannels"
        and "postChannels" + 1.

    :params matrix: a matrix (2d nested list) containing numbers, each isobaric
        channel must be present as a row.
    :params preChannels: number of matrix columns with a nominal mass shift < 0
        (-1, -2,..) in respect to the reporter ion mz value.
    :params postChannels: number of matrix columns with a nominal mass shift > 0
        (+1, +2,..) in respect to the reporter ion mz value.

    :returns: extended matrix, where the number of rows is unchanged but the
        length of each row is extend to the number of rows.

def _padImpurityMatrix(matrix, preChannels, postChannels):
    """Align the values of an isotope impurity matrix and fill up with 0.

    NOTE:
        The length of the rows in the "matrix" must be the sum of "preChannels"
        and "postChannels" + 1.

    :params matrix: a matrix (2d nested list) containing numbers, each isobaric
        channel must be present as a row.
    :params preChannels: number of matrix columns with a nominal mass shift < 0
        (-1, -2,..) in respect to the reporter ion mz value.
    :params postChannels: number of matrix columns with a nominal mass shift > 0
        (+1, +2,..) in respect to the reporter ion mz value.

    :returns: extended matrix, where the number of rows is unchanged but the
        length of each row is extend to the number of rows.
    """
    extendedMatrix = list()
    lastMatrixI = len(matrix)-1
    for i, line in enumerate(matrix):
        prePadding = itertools.repeat(0., i)
        postPadding = itertools.repeat(0., lastMatrixI-i)
        newLine = list(itertools.chain(prePadding, line, postPadding))
        extendedMatrix.append(newLine[preChannels:-postChannels])

    return extendedMatrix