def split_at_linelen(line, length):
    """Split a line at specific length for code blocks or 
       other formatted RST sections.
    """
    # Get number of splits we should have in line
    i = int(len(line)/length)
    p = 0

    while i > 0:
        p = p+length
        # If position in string is not a space
        # walk backwards until we hit a space
        while line[p] != ' ':
            p -= 1

        # Split the line
        line = line[:p] + '\n' + line[p+1:]
        i -= 1

    return line