code: def has_context(func):
      @functools.wraps(func)
      def assert_context(*args, **kwargs):
          if not context_value.get():
              raise exceptions.MissingCallbackContextException(
                  f"dash.callback_context.{getattr(func, '__name__')} is only available from a callback!"
              )
          return func(*args, **kwargs)
  
      return assert_context
  
imports: import functools
  import warnings
  import json
  import contextvars
  import flask
  from .None import exceptions
  from ._utils import AttributeDict
label_desc: Use image node_id 1 for calling a global function with example usage: has_context(func) and returns: assert_context, func