# Buggy code
def _handle_global_configuration(config):
    # print location of global configuration
    print(MSG_GLOBAL_SETTINGS_LOCATION.format(config.config_path))
    # set up the config parsers
    file_config = get_config_parser()
    config_exists = file_config.read([config.config_path])
    should_modify_global_config = False
    if config_exists:
        # print current config and prompt to allow global config modification
        _print_cur_configuration(file_config)
        should_modify_global_config = prompt_y_n(MSG_PROMPT_MANAGE_GLOBAL, default="n")
        answers["modify_global_prompt"] = should_modify_global_config
    if not config_exists or should_modify_global_config:
        # no config exists yet so configure global config or user wants to modify global config
        need_to_reset_use_local_config = config.use_local_config
        if need_to_reset_use_local_config:
            config.set_to_use_local_config(False)
        output_index = prompt_choice_list(
            MSG_PROMPT_GLOBAL_OUTPUT,
            OUTPUT_LIST,
            default=get_default_from_config(config, "core", "output", OUTPUT_LIST),
        )
        answers["output_type_prompt"] = output_index
        answers["output_type_options"] = str(OUTPUT_LIST)
        enable_file_logging = prompt_y_n(MSG_PROMPT_FILE_LOGGING, default="n")
        allow_telemetry = prompt_y_n(MSG_PROMPT_TELEMETRY, default="y")
        answers["telemetry_prompt"] = allow_telemetry
        # save the global config
        config.set_value("core", "output", OUTPUT_LIST[output_index]["name"])
        config.set_value(
            "core", "collect_telemetry", "yes" if allow_telemetry else "no"
        )
        config.set_value(
            "logging", "enable_log_file", "yes" if enable_file_logging else "no"
        )
        if need_to_reset_use_local_config:
            config.set_to_use_local_config(True)


# Traceback (TypeError)
join() argument must be str or bytes, not 'NoneType'
Traceback (most recent call last):
python3.7/site-packages/knack/cli.py, ln 206, in invoke
cmd_result = self.invocation.execute(args)
cli/core/commands/__init__.py, ln 523, in execute
raise ex
cli/core/commands/__init__.py, ln 581, in _run_jobs_serially
results.append(self._run_job(expanded_arg, cmd_copy))
cli/core/commands/__init__.py, ln 574, in _run_job
six.reraise(*sys.exc_info())
...
cli/command_modules/configure/custom.py, ln 194, in show_cache_contents
item_path = os.path.join(directory, resource_group_name, resource_type, '{}.json'.format(item_name))
../lib/python3.7/posixpath.py, ln 94, in join
genericpath._check_arg_types('join', a, *p)
../lib/python3.7/genericpath.py, ln 149, in _check_arg_types
(funcname, s.__class__.__name__)) from None
TypeError: join() argument must be str or bytes, not 'NoneType'

# Fixed code
def _handle_global_configuration(config):
    # print location of global configuration
    print(MSG_GLOBAL_SETTINGS_LOCATION.format(config.config_path))
    # set up the config parsers
    file_config = get_config_parser()
    config_exists = file_config.read([config.config_path])
    should_modify_global_config = False
    if config_exists:
        # print current config and prompt to allow global config modification
        _print_cur_configuration(file_config)
        should_modify_global_config = prompt_y_n(MSG_PROMPT_MANAGE_GLOBAL, default="n")
        answers["modify_global_prompt"] = should_modify_global_config
    if not config_exists or should_modify_global_config:
        # no config exists yet so configure global config or user wants to modify global config
        need_to_reset_use_local_config = config.use_local_config
        if need_to_reset_use_local_config:
            config.set_to_use_local_config(False)
        output_index = prompt_choice_list(
            MSG_PROMPT_GLOBAL_OUTPUT,
            OUTPUT_LIST,
            default=get_default_from_config(config, "core", "output", OUTPUT_LIST),
        )
        answers["output_type_prompt"] = output_index
        answers["output_type_options"] = str(OUTPUT_LIST)
        enable_file_logging = prompt_y_n(MSG_PROMPT_FILE_LOGGING, default="n")
        allow_telemetry = prompt_y_n(MSG_PROMPT_TELEMETRY, default="y")
        answers["telemetry_prompt"] = allow_telemetry
        cache_ttl = None
        while not cache_ttl:
            try:
                cache_ttl = prompt(MSG_PROMPT_CACHE_TTL) or DEFAULT_CACHE_TTL
                # ensure valid int by casting
                cache_value = int(cache_ttl)
                if cache_value < 1:
                    raise ValueError
            except ValueError:
                logger.error("TTL must be a positive integer")
                cache_ttl = None
        # save the global config
        config.set_value("core", "output", OUTPUT_LIST[output_index]["name"])
        config.set_value(
            "core", "collect_telemetry", "yes" if allow_telemetry else "no"
        )
        config.set_value("core", "cache_ttl", cache_ttl)
        config.set_value(
            "logging", "enable_log_file", "yes" if enable_file_logging else "no"
        )
        if need_to_reset_use_local_config:
            config.set_to_use_local_config(True)