docs: def assert_consistent_reg_options(exec_type, json_spec, executable_builder_exeception):
      """
      Validates the "regionalOptions" field and verifies all the regions used
      in "regionalOptions" have the same options.
      """
      reg_options_spec = json_spec.get('regionalOptions')
      json_fn = 'dxapp.json' if exec_type == 'app' else 'dxworkflow.json'
  
      if not isinstance(reg_options_spec, dict):
          raise executable_builder_exeception("The field 'regionalOptions' in  must be a mapping")
      if not reg_options_spec:
          raise executable_builder_exeception(
              "The field 'regionalOptions' in " + json_fn + " must be a non-empty mapping")
      regional_options_list = list(reg_options_spec.items())
      for region, opts_for_region in regional_options_list:
          if not isinstance(opts_for_region, dict):
              raise executable_builder_exeception("The field 'regionalOptions['" + region +
                              "']' in " + json_fn + " must be a mapping")
          if set(opts_for_region.keys()) != set(regional_options_list[0][1].keys()):
              if set(opts_for_region.keys()) - set(regional_options_list[0][1].keys()):
                  with_key, without_key = region, regional_options_list[0][0]
                  key_name = next(iter(set(opts_for_region.keys()) - set(regional_options_list[0][1].keys())))
              else:
                  with_key, without_key = regional_options_list[0][0], region
                  key_name = next(iter(set(regional_options_list[0][1].keys()) - set(opts_for_region.keys())))
              raise executable_builder_exeception(
                  "All regions in regionalOptions must specify the same options; " +
                  "%s was given for %s but not for %s" % (key_name, with_key, without_key)
              )
  
          if exec_type == 'app':
              for key in opts_for_region:
                  if key in json_spec.get('runSpec', {}):
                      raise executable_builder_exeception(
                      key + " cannot be given in both runSpec and in regional options for " + region)