code: def test_is_headless(flow, expected):
      flow = flow()
      app = LightningApp(flow)
      assert _is_headless(app) == expected
  
imports: from functools import partial
  from unittest import mock
  import pytest
  from lightning.app import LightningApp, LightningFlow, LightningWork
  from lightning.app.core.flow import _RootFlow
  from lightning.app.frontend import StaticWebFrontend
  from lightning.app.utilities.app_helpers import AppStatePlugin, BaseStatePlugin, InMemoryStateStore, StateStore, _is_headless, _MagicMockJsonSerializable, is_overridden, is_static_method
  from lightning.app.utilities.exceptions import LightningAppStateException
label_desc: Use image node_id 6 for calling a global function with example usage: test_is_headless(flow, expected) without return types