def createLineSegment(sequence, maxLineSegmentLength, sequenceStringIndex):
    """
    Creates a segment of the pyramid on one line.

    Params:
    sequence - Full string representing the sequence.
    maxLineSegmentLength - Maximum length of one line segment
    sequenceStringIndex - A reference to an index for fetching sequence
    characters.

    Returns:
    currentLineSegment - A segment that will be part of the current line to
    print.
    """
    currentLineSegment = ""
    for _ in range(maxLineSegmentLength):
        currentLineSegment += sequence[sequenceStringIndex[0]]
        sequenceStringIndex[0] += 1
    return currentLineSegment