<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def prompt(self, prompt_msg=None, newline=False):
 """ Writes prompt message to output stream and reads line from standard input stream. `prompt_msg` Message to write. `newline` Append newline character to prompt message before writing. Return string. """


        if prompt_msg is not None:
            self.write(prompt_msg, newline)

        return self._input.readline().rstrip(os.linesep)