code: def done_context(ctx):
      """
      Detach from a context cleanly.
  
      Detach from a context and remove its pop() from atexit.
  
      Parameters
      ----------
      ctx : pycuda.driver.Context
          Context from which to detach.
      """
  
      for i in range(len(atexit._exithandlers)):
          if atexit._exithandlers[i][0] == ctx.pop:
              del atexit._exithandlers[i]
              break
      ctx.detach()
  
imports: from __future__ import absolute_import, division
  import atexit
  import numbers
  from string import Template
  import pycuda.driver
  import pycuda.gpuarray
  import pycuda.elementwise
  import pycuda.reduction
  import pycuda.scan
  import pycuda.tools
  from pycuda.tools import context_dependent_memoize, dtype_to_ctype
  from pycuda.compiler import SourceModule
  from pytools import memoize
  import numpy
  from .None import cuda
  from .None import cublas
  import sys
  import operator
label_desc: Use image node_id 3 for calling a global function with example usage: done_context(ctx) without return types