code: def _check_res(res):
      if res == EGL_NO_SURFACE:
          e = eglGetError()
      else:
          return res
      if e == EGL_BAD_MATCH:
          raise ValueError(
              "Cannot create surface: attributes do not match "
              + "or given config cannot render in window."
          )
      elif e == EGL_BAD_CONFIG:
          raise ValueError(
              "Cannot create surface: given config is not "
              + "supported by this system."
          )
      elif e == EGL_BAD_NATIVE_WINDOW:
          raise ValueError(
              "Cannot create surface: the given native window "
              + "handle is invalid."
          )
      elif e == EGL_BAD_ALLOC:
          raise RuntimeError(
              "Could not allocate surface: not enough "
              + "resources or native window already associated "
              + "with another config."
          )
      else:
          raise RuntimeError(
              "Could not create window surface due to "
              + "unknown error: %i" % e
          )
  
file_path: vispy/vispy/ext/egl.py
imports: import os
  import ctypes
  from ctypes import c_int, POINTER, c_void_p, c_char_p
label_desc: Use image node_id 8 for calling a global function with example usage: _check_res(res) and returns: res