code: def _is_binary_writer(
      stream: t.IO[t.Any], default: bool = False
  ) -> bool:
      try:
          stream.write(b"")
      except Exception:
          try:
              stream.write("")
              return False
          except Exception:
              pass
          return default
      return True
  
imports: import codecs
  import io
  import os
  import re
  import sys
  import typing
  from weakref import WeakKeyDictionary
label_desc: Use image node_id 5 for calling a global function with example usage: _is_binary_writer(stream, default) and returns: True, default, False