code: def buffer_writer_close_cb(bufferwriter, callback, overwrite=False):
      # type: (Any, Callable[[Any], None], bool) -> ()
      # noinspection PyBroadException
      try:
          if not hasattr(bufferwriter, "_trains_org_close"):
              bufferwriter._trains_org_close = bufferwriter.close
              bufferwriter.close = partial(
                  __buffer_writer_close_patch, bufferwriter
              )
          elif not overwrite and hasattr(
              bufferwriter, "_trains_close_cb"
          ):
              return
  
          bufferwriter._trains_close_cb = callback
      except Exception:
          pass
  
file_path: clearml/clearml/utilities/lowlevel/file_access.py
imports: import os
  import sys
  from functools import partial
  import six
  from typing import Optional, Any, Callable
label_desc: Use image node_id 2 for calling a global function with example usage: buffer_writer_close_cb(bufferwriter, callback, overwrite) without return types