checks if the file is a valid config file
        Args:
            filepath:

def load_config(self, filepath=None):
        """
        checks if the file is a valid config file
        Args:
            filepath:

        """

        # load config or default if invalid

        def load_settings(filepath):
            """
            loads a old_gui settings file (a json dictionary)
            - path_to_file: path to file that contains the dictionary

            Returns:
                - instruments: depth 1 dictionary where keys are instrument names and values are instances of instruments
                - scripts:  depth 1 dictionary where keys are script names and values are instances of scripts
                - probes: depth 1 dictionary where to be decided....?
            """

            instruments_loaded = {}
            probes_loaded = {}
            scripts_loaded = {}

            if filepath and os.path.isfile(filepath):
                in_data = load_b26_file(filepath)

                instruments = in_data['instruments'] if 'instruments' in in_data else {}
                scripts = in_data['scripts'] if 'scripts' in in_data else {}
                probes = in_data['probes'] if 'probes' in in_data else {}

                try:
                    instruments_loaded, failed = Instrument.load_and_append(instruments)
                    if len(failed) > 0:
                        print(('WARNING! Following instruments could not be loaded: ', failed))

                    scripts_loaded, failed, instruments_loaded = Script.load_and_append(
                        script_dict=scripts,
                        instruments=instruments_loaded,
                        log_function=self.log,
                        data_path=self.gui_settings['data_folder'])

                    if len(failed) > 0:
                        print(('WARNING! Following scripts could not be loaded: ', failed))

                    probes_loaded, failed, instruments_loadeds = Probe.load_and_append(
                        probe_dict=probes,
                        probes=probes_loaded,
                        instruments=instruments_loaded)

                    self.log('Successfully loaded from previous save.')
                except ImportError:
                    self.log('Could not load instruments or scripts from file.')
                    self.log('Opening with blank GUI.')
            return instruments_loaded, scripts_loaded, probes_loaded

        config = None

        try:
            config = load_b26_file(filepath)
            config_settings = config['gui_settings']
            if config_settings['gui_settings'] != filepath:
                print((
                'WARNING path to settings file ({:s}) in config file is different from path of settings file ({:s})'.format(
                    config_settings['gui_settings'], filepath)))
            config_settings['gui_settings'] = filepath
        except Exception as e:
            if filepath:
                self.log('The filepath was invalid --- could not load settings. Loading blank GUI.')
            config_settings = self._DEFAULT_CONFIG


            for x in self._DEFAULT_CONFIG.keys():
                if x in config_settings:
                    if not os.path.exists(config_settings[x]):
                        try:
                            os.makedirs(config_settings[x])
                        except Exception:
                            config_settings[x] = self._DEFAULT_CONFIG[x]
                            os.makedirs(config_settings[x])
                            print(('WARNING: failed validating or creating path: set to default path'.format(config_settings[x])))
                else:
                    config_settings[x] = self._DEFAULT_CONFIG[x]
                    os.makedirs(config_settings[x])
                    print(('WARNING: path {:s} not specified set to default {:s}'.format(x, config_settings[x])))

        # check if file_name is a valid filename
        if filepath is not None and os.path.exists(os.path.dirname(filepath)):
            config_settings['gui_settings'] = filepath

        self.gui_settings = config_settings

        if(config):
            self.gui_settings_hidden = config['gui_settings_hidden']
        else:
            self.gui_settings_hidden['script_source_folder'] = ''

        self.instruments, self.scripts, self.probes = load_settings(filepath)


        self.refresh_tree(self.tree_gui_settings, self.gui_settings)
        self.refresh_tree(self.tree_scripts, self.scripts)
        self.refresh_tree(self.tree_settings, self.instruments)

        self._hide_parameters(filepath)