code: def _maybe_apply_flag(param, flags):
      arg_name = _param_arg_name(param)
      if not arg_name or not isinstance(param, click.Option):
          log.debug("skipping %s - not a flag option", param.name)
          return
      flag_name = arg_name  # Use long form arg name as flag name.
      flags[flag_name] = attrs = {}
      if param.help:
          attrs["description"] = param.help
      if param.default is not None:
          attrs["default"] = _ensure_json_encodable(
              param.default, flag_name
          )
      if isinstance(param.type, click.Choice):
          attrs["choices"] = _ensure_json_encodable(
              param.type.choices, flag_name
          )
      if param.required:
          attrs["required"] = True
      if param.is_flag:
          attrs["arg-switch"] = not param.default
      _apply_type_flag_attr(param, attrs)
      log.debug("added flag %r: %r", flag_name, attrs)
  
imports: import argparse
  import json
  import logging
  import os
  import subprocess
  import sys
  import click
  from guild import python_util
  from guild import util
  from .None import import_argparse_flags_main
  from .None import python_script
label_desc: Use image node_id 9 for calling a global function with example usage: _maybe_apply_flag(param, flags) without return types