code: def replace_cr_with_newline(message: str):
      
      if '\r' in message:
          message = message.replace('\r', '')
          if not message or message[-1] != '\n':
              message += '\n'
      return message
docs: TQDM and requests use carriage returns to get the training line to update for each batch
      without adding more lines to the terminal output.  Displaying those in a file won't work
      correctly, so we'll just make sure that each batch shows up on its one line.
      :param message: the message to permute
      :return: the message with carriage returns replaced with newlines