code: def is_notebook():
      """
      检查当前运行环境是否为 jupyter
  
      :return:
      """
      try:
          from IPython import get_ipython
  
          if (
              "IPKernelApp" not in get_ipython().config
          ):  # pragma: no cover
              raise ImportError("console")
          if "VSCODE_PID" in os.environ:  # pragma: no cover
              raise ImportError("vscode")
      except:
          return False
      else:  # pragma: no cover
          return True
  
imports: import functools
  import inspect
  from inspect import Parameter
  import dataclasses
  from dataclasses import is_dataclass
  from copy import deepcopy
  from collections import defaultdict, OrderedDict
  from typing import Callable, List, Any, Dict, AnyStr, Union, Mapping, Sequence
  from typing import Tuple, Optional
  from time import sleep
  import os
  from contextlib import contextmanager
  from functools import wraps
  from prettytable import PrettyTable
  from pathlib import Path
  from fastNLP.core.log import logger
label_desc: Use image node_id 19 for calling a global function with example usage: is_notebook() and returns: True, False