code: def check_type(x, t, accept_none=False):
      """
      Checks whether a variable is convertible to a certain type.
      A ValueError is raised if test fails.
  
      Parameters
      ----------
      x : object
          Input argument to be checked.
      t : type
          Target type.
      accept_none : bool
          If True, skip errors if `x` is None.
      """
      if accept_none:
          if x is None:
              return
      if not _check_type(x, t):
          raise ValueError(f"Argument should be convertible to {t}")
  
imports: import numpy
label_desc: Use image node_id 2 for calling a global function with example usage: check_type(x, t, accept_none) without return types