class_docstr: File stream policy for removing carriage-return erased characters.
  
  This is what a terminal does. We use it for console output to reduce the amount of
  data we need to send over the network (eg. for progress bars), while preserving the
  output's appearance in the web app.
  
  CR stands for "carriage return", for the character \r. It tells the terminal to move
  the cursor back to the start of the current line. Progress bars (like tqdm) use \r
  repeatedly to overwrite a line with newer updates. This gives the illusion of the
  progress bar filling up in real-time.
docstr: Split chunks.
  
  Args:
      chunk: object with two fields: filename (str) & data (str)
      `chunk.data` is a str containing the lines we want. It usually contains \n or \r or both.
      `chunk.data` has two possible formats (for the two streams - stdout and stderr):
          - "2020-08-25T20:38:36.895321 this is my line of text\nsecond line\n"
          - "ERROR 2020-08-25T20:38:36.895321 this is my line of text\nsecond line\nthird\n".
  
          Here's another example with a carriage return \r.
          - "ERROR 2020-08-25T20:38:36.895321 \r progress bar\n"
  
  Returns:
      A 2-tuple of strings.
      First str is prefix, either "ERROR {timestamp} " or "{timestamp} ".
      Second str is the rest of the string.
  
  Example:
      >>> chunk = Chunk(filename="output.log", data="ERROR 2020-08-25T20:38 this is my line of text\n")
      >>> split_chunk(chunk)
      ("ERROR 2020-08-25T20:38 ", "this is my line of text\n")
docstr_tok: ["Split","chunks",".","Args",":","chunk",":","object","with","two","fields",":","filename","(","str",")","&","data","(","str",")","`","chunk.data","`","is","a","str","containing","the","lines","we","want",".","It","usually","contains","\\n","or","\\r","or","both",".","`","chunk.data","`","has","two","possible","formats","(","for","the","two","streams","-","stdout","and","stderr",")",":","-","``","2020-08-25T20:38:36.895321","this","is","my","line","of","text\\nsecond","line\\n","''","-","``","ERROR","2020-08-25T20:38:36.895321","this","is","my","line","of","text\\nsecond","line\\nthird\\n","''",".","Here","'s","another","example","with","a","carriage","return","\\r",".","-","``","ERROR","2020-08-25T20:38:36.895321","\\r","progress","bar\\n","''","Returns",":","A","2-tuple","of","strings",".","First","str","is","prefix",",","either","``","ERROR","{","timestamp","}","``","or","``","{","timestamp","}","``",".","Second","str","is","the","rest","of","the","string",".","Example",":",">",">",">","chunk","=","Chunk","(","filename=","''","output.log","''",",","data=","''","ERROR","2020-08-25T20:38","this","is","my","line","of","text\\n","''",")",">",">",">","split_chunk","(","chunk",")","(","``","ERROR","2020-08-25T20:38","``",",","``","this","is","my","line","of","text\\n","''",")"]
code: def split_chunk(chunk: Chunk) -> Tuple[str, str]:
      r"""Split chunks.
  
      Args:
          chunk: object with two fields: filename (str) & data (str)
          `chunk.data` is a str containing the lines we want. It usually contains \n or \r or both.
          `chunk.data` has two possible formats (for the two streams - stdout and stderr):
              - "2020-08-25T20:38:36.895321 this is my line of text\nsecond line\n"
              - "ERROR 2020-08-25T20:38:36.895321 this is my line of text\nsecond line\nthird\n".
  
              Here's another example with a carriage return \r.
              - "ERROR 2020-08-25T20:38:36.895321 \r progress bar\n"
  
      Returns:
          A 2-tuple of strings.
          First str is prefix, either "ERROR {timestamp} " or "{timestamp} ".
          Second str is the rest of the string.
  
      Example:
          >>> chunk = Chunk(filename="output.log", data="ERROR 2020-08-25T20:38 this is my line of text\n")
          >>> split_chunk(chunk)
          ("ERROR 2020-08-25T20:38 ", "this is my line of text\n")
      """
      prefix = ""
      token, rest = chunk.data.split(" ", 1)
      if token == "ERROR":
          prefix += token + " "
          token, rest = rest.split(" ", 1)
      prefix += token + " "
      return prefix, rest
  
imports: import base64
  import functools
  import itertools
  import logging
  import os
  import queue
  import random
  import sys
  import threading
  import time
  from types import TracebackType
  from typing import TYPE_CHECKING, Any, Callable, Dict, List, NamedTuple, Optional, Set, Tuple, Type, Union
  import requests
  import wandb
  from wandb import util
  from wandb.sdk.internal import internal_api
  from ..lib import file_stream_utils
label_desc: Use image node_id 3 for calling the CRDedupeFilePolicy obj's underlying member method code with example usage: obj.split_chunk(chunk) and returns: prefix,  rest