'Handle the selected tool panel location for loading tools included in
tool shed repositories when installing or reinstalling them.'

def handle_tool_panel_selection(self, toolbox, metadata, no_changes_checked, tool_panel_section_id, new_tool_panel_section_label):

    tool_section = None
    tool_panel_section_key = None
    if ('tools' in metadata):
        if no_changes_checked:
            new_tool_panel_section_label = None
            if ('tool_panel_section' in metadata):
                tool_panel_dict = metadata['tool_panel_section']
                if (not tool_panel_dict):
                    tool_panel_dict = self.generate_tool_panel_dict_for_new_install(metadata['tools'])
            else:
                tool_panel_dict = self.generate_tool_panel_dict_for_new_install(metadata['tools'])
            if tool_panel_dict:
                tool_section_dicts = tool_panel_dict[next(iter(tool_panel_dict))]
                tool_section_dict = tool_section_dicts[0]
                original_section_id = tool_section_dict['id']
                if original_section_id:
                    (tool_panel_section_key, tool_section) = self.get_or_create_tool_section(toolbox, tool_panel_section_id=original_section_id, new_tool_panel_section_label=new_tool_panel_section_label)
        else:
            (tool_panel_section_key, tool_section) = self.handle_tool_panel_section(toolbox, tool_panel_section_id=tool_panel_section_id, new_tool_panel_section_label=new_tool_panel_section_label)
    return (tool_section, tool_panel_section_key)
