docs: def is_magic(line, language, global_escape_flag=True):
      """Is the current line a (possibly escaped) Jupyter magic, and should it be commented?"""
      if language in ['octave', 'matlab']:
          return False
      if _MAGIC_FORCE_ESC_RE.get(language, _MAGIC_FORCE_ESC_RE['python']).match(line):
          return True
      if not global_escape_flag or _MAGIC_NOT_ESC_RE.get(language, _MAGIC_NOT_ESC_RE['python']).match(line):
          return False
      if _MAGIC_RE.get(language, _MAGIC_RE['python']).match(line):
          return True
      if language != 'python':
          return False
      if _PYTHON_HELP_OR_BASH_CMD.match(line):
          return True
      return _PYTHON_MAGIC_CMD.match(line)