async def METHOD_NAME(
    input_file: TextIO,
    output_file: TextIO,
    brief_prompt: bool = True,
) -> Optional[CanMessage]:
    """Get user input with proper buffering."""
    def prompt_with_io(promptstr: str) -> str:
        output_file.write(promptstr)
        output_file.flush()
        userinput = input_file.readline()
        if userinput.lower().strip() in ["exit", "quit"]:
            raise SystemExit()
        return userinput
    def write_with_newline(outstr: str) -> None:
        output_file.write(outstr + "\n")
        output_file.flush()
    try:
        return await asyncio.get_event_loop().run_in_executor(
            None, prompt_message, prompt_with_io, write_with_newline, brief_prompt
        )
    except InvalidInput as e:
        # Write error in red.
        write_with_newline(f"\033[1;31;40m{str(e)}\033[0m")
    return None