code: def _buffered_write_file(fobj):
      """Return a buffered version of a write file object."""
      if PY27 and bz2 is not None and isinstance(fobj, bz2.BZ2File):
          # Python 2.7 doesn't work with BZ2File through a buffer: no attribute
          # 'writable'.
          # BZ2File doesn't implement the file object context manager in python 2
          # so we wrap the fileobj using `closing`.
          return closing(fobj)
      else:
          return io.BufferedWriter(fobj, buffer_size=_IO_BUFFER_SIZE)
  
imports: import pickle
  import sys
  import io
  import zlib
  import gzip
  import warnings
  import contextlib
  from contextlib import closing
  from ._compat import PY3_OR_LATER, PY27, _basestring
label_desc: Use image node_id 4 for calling a global function with example usage: _buffered_write_file(fobj) and returns: closing, io