def _insert_space(end_index, string):
    """Inserts the number of spaces required given the string and the position
    of the next non-blank field.

    Parameters:
        end_index : int
            Expected string length
        string : str
            String to add spaces to
    Returns:
        string_with_blanks : str
            String with spaces padded on the end
    """
    string += ' ' * (end_index - len(string))
    return string