code: def mark_flag_as_required(flag_name, flag_values=FLAGS):
    
    if flag_values[flag_name].default is not None:
      # TODO(vrusinov): Turn this warning into an exception.
      warnings.warn(
          'Flag %s has a non-None default value; therefore, '
          'mark_flag_as_required will pass even if flag is not specified in the '
          'command line!' % flag_name)
    register_validator(flag_name,
                       lambda value: value is not None,
                       message='Flag --%s must be specified.' % flag_name,
                       flag_values=flag_values)
docs: Ensures that flag is not None during program execution.
  
    Registers a flag validator, which will follow usual validator rules.
    Important note: validator will pass for any non-None value, such as False,
    0 (zero), '' (empty string) and so on.
  
    It is recommended to call this method like this:
  
      if __name__ == '__main__':
        gflags.mark_flag_as_required('your_flag_name')
        app.run()
  
    Because validation happens at app.run() we want to ensure required-ness
    is enforced at that time.  However, you generally do not want to force
    users who import your code to have additional required flags for their
    own binaries or tests.
  
    Args:
      flag_name: string, name of the flag
      flag_values: FlagValues
    Raises:
      AttributeError: if flag_name is not registered as a valid flag name.