code: def _check_method(method, methods):
      if method not in methods:
          message = "Unknown fit method %s" % method
          raise ValueError(message)
  
imports: from __future__ import annotations
  from statsmodels.compat.scipy import SP_LT_15, SP_LT_17
  from typing import Any
  from collections.abc import Sequence
  import numpy
  from scipy import optimize
label_desc: Use image node_id 2 for calling a global function with example usage: _check_method(method, methods) without return types