code: def _find_error_type(line):
      """Find the error name given the first line of the error message.
  
      Parameters
      ----------
      line : str
          The first line of error message.
  
      Returns
      -------
      name : str The error name
      """
      if sys.platform == "win32":
          # Stack traces aren't logged on Windows due to a DMLC limitation,
          # so we should try to get the underlying error another way.
          # DMLC formats errors "[timestamp] file:line: ErrorMessage"
          # ErrorMessage is usually formatted "ErrorType: message"
          # We can try to extract the error type using the final ":"
          end_pos = line.rfind(":")
          if end_pos == -1:
              return None
          start_pos = line.rfind(":", 0, end_pos)
          if start_pos == -1:
              err_name = line[:end_pos].strip()
          else:
              err_name = line[start_pos + 1 : end_pos].strip()
          if _valid_error_name(err_name):
              return err_name
          return None
  
      end_pos = line.find(":")
      if end_pos == -1:
          return None
      err_name = line[:end_pos]
      if _valid_error_name(err_name):
          return err_name
      return None
  
imports: import ctypes
  import functools
  import os
  import re
  import sys
  import types
  from typing import Callable, Sequence, Optional
  import numpy
  from .None import libinfo
label_desc: Use image node_id 7 for calling a global function with example usage: _find_error_type(line) and returns: None, None, None, err_name, None, err_name