def write_line(output_buffer, line, windows_newline=True, avoid_empty=False):
    """
    Writes the provided line to the output buffer, considering the windows
    newline option. This is considered a normalization operation.

    :type output_buffer: StringBuffer
    :param output_buffer: The output buffer.
    :type line: List
    :param line: The line that is going to be written to output buffer.
    :type windows_newline: bool
    :param windows_newline: If the windows newline should be used.
    :type avoid_empty: bool
    :param avoid_empty: If the empty lines (after strip operation)
    should be considered invalid and not written to buffer.
    """
    line = line.rstrip()
    output_buffer.write(line)
    if avoid_empty and not line:
        return
    if windows_newline:
        output_buffer.write('\r\n')
    else:
        output_buffer.write('\n')
