code: def _is_method(func: Callable[..., Any]) -> bool:
      """Check if the specified function is a method.
  
      Parameters
      ----------
      func
          the function to inspect.
  
      Returns
      -------
      bool
          true if `func` is a method, false otherwise.
      """
      spec = signature(func)
      if len(spec.parameters) > 0:
          if list(spec.parameters.keys())[0] == "self":
              return True
      return False
  
file_path: darts/darts/utils/torch.py
imports: from functools import wraps
  from inspect import signature
  from typing import Any, Callable, TypeVar
  import torch.nn
  import torch.nn.functional
  from numpy.random import randint
  from sklearn.utils import check_random_state
  from torch import Tensor
  from torch.random import fork_rng, manual_seed
  from darts.logging import get_logger, raise_if_not
label_desc: Use image node_id 1 for calling a global function with example usage: _is_method(func) and returns: False, True