code: def refine(line, prefix=None, suffix=None):
      line = to_bytes(line)
      prefix = to_bytes(prefix) if prefix else b""
      suffix = to_bytes(suffix) if suffix else b""
      parts = line.split(b"]", 1)
      if len(parts) == 2:
          header, body = parts
          return b"".join((header, b"]", prefix, body, suffix))
      else:
          return line
  
file_path: metaflow/metaflow/mflog/mflog.py
imports: import heapq
  import re
  import time
  import uuid
  from datetime import datetime
  from collections import namedtuple
  from metaflow.util import to_bytes, to_fileobj, to_unicode
label_desc: Use image node_id 6 for calling a global function with example usage: refine(line, prefix, suffix) and returns: bytes, line