<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def create_cfg(self, cfg_file, defaults=None, mode='json'):
        '''
        set mode to json or yaml? probably remove this option..Todo

        Creates the config file for your app with default values
        The file will only be created if it doesn't exits

        also sets up the first_run attribute.

        also sets correct windows permissions

        you can add custom stuff to the config by doing
        app.cfg['fkdsfa'] = 'fdsaf'
        # todo auto save on change
        remember to call cfg.save()

        '''
        assert mode in ('json', 'yaml')
        self.cfg_mode = mode
        self.cfg_file = cfg_file
        try:
            self.cfg = CfgDict(app=self, cfg=self.load_cfg())
            logging.info('cfg file found : %s' % self.cfg_file)
        except FileNotFoundError:
            self.cfg = CfgDict(app=self, cfg={'first_run': True})
            with suppress(TypeError):
                self.cfg.update(defaults)
            self.cfg.save()
            set_windows_permissions(self.cfg_file)
            logging.info(
                'Created cfg file for first time!: %s' %
                self.cfg_file)

        if self._check_first_run():
            self.first_run = True
        else:
            self.first_run = False