code: def _sanitize(string):
      # Turn any escaped bytes into unicode 'unknown' char.  If the escaped
      # bytes happen to be utf-8 they will instead get decoded, even if they
      # were invalid in the charset the source was supposed to be in.  This
      # seems like it is not a bad thing; a defect was still registered.
      original_bytes = string.encode("utf-8", "surrogateescape")
      return original_bytes.decode("utf-8", "replace")
  
imports: import os
  import re
  import time
  import random
  import socket
  import datetime
  import urllib.parse
  from email._parseaddr import quote
  from email._parseaddr import AddressList
  from email._parseaddr import mktime_tz
  from email._parseaddr import parsedate, parsedate_tz, _parsedate_tz
  from email.charset import Charset
label_desc: Use image node_id 2 for calling a global function with example usage: _sanitize(string) and returns: original_bytes