code: def context(dev_type, dev_id=0):
      """Construct a DGL context with given device type and id.
  
      Parameters
      ----------
      dev_type: int or str
          The device type mask or name of the device.
  
      dev_id : int, optional
          The integer device id
  
      Returns
      -------
      ctx: DGLContext
          The corresponding context.
  
      Examples
      --------
      Context can be used to create reflection of context by
      string representation of the device type.
  
      .. code-block:: python
  
        assert dgl.context("cpu", 1) == dgl.cpu(1)
        assert dgl.context("gpu", 0) == dgl.gpu(0)
        assert dgl.context("cuda", 0) == dgl.gpu(0)
      """
      if isinstance(dev_type, string_types):
          dev_type = dev_type.split()[0]
          if dev_type not in DGLContext.STR2MASK:
              raise ValueError("Unknown device type %s" % dev_type)
          dev_type = DGLContext.STR2MASK[dev_type]
      return DGLContext(dev_type, dev_id)
  
imports: from __future__ import absolute_import
  import ctypes
  import sys
  import numpy
  from .base import _FFI_MODE, _LIB, c_array, c_str, check_call, string_types
  from .runtime_ctypes import dgl_shape_index_t, DGLArray, DGLArrayHandle, DGLContext, DGLDataType, TypeCode
label_desc: Use image node_id 1 for calling a global function with example usage: context(dev_type, dev_id) and returns: DGLContext