code: def _require_flag(flag: flags.FlagHolder[_T]) -> _T:
      if not flag.present:
          raise flags.ValidationError(
              f"Flag --{flag.name} is required."
          )
      return flag.value
  
imports: from typing import TypeVar
  from absl import flags
  from tfx.orchestration.portable import data_types
  from tfx.orchestration.python_execution_binary import python_execution_binary_utils
label_desc: Use image node_id 1 for calling a global function with example usage: _require_flag(flag) and returns: flag