code: def get_best_encoding(stream):
      """Returns the default stream encoding if not found."""
      rv = getattr(stream, "encoding", None) or sys.getdefaultencoding()
      if is_ascii_encoding(rv):
          return "utf-8"
      return rv
  
imports: import codecs
  import io
  import os
  import re
  import sys
  from weakref import WeakKeyDictionary
label_desc: Use image node_id 4 for calling a global function with example usage: get_best_encoding(stream) and returns: rv, str