def METHOD_NAME(self, *args, **kwargs):
    save = False
    if 'save' in kwargs:
        save = kwargs['save']
        kwargs.pop('save', None)
    if save:
        qkit.flow.start()
    output = func(self, *args, **kwargs)
    if save:
        if self.dirname:
            self._file_name = 'QM_experiment_' + self.exp_name + '_' + self.dirname
        else:
            self._file_name = 'QM_experiment_' + self.exp_name
        self._file_name = self._file_name.replace(' ', '').replace(',', '_')
        # Save function arguments and qm program
        astring = ""
        for value in args:
            astring += "{}, ".format(value)
        kstring = ""
        for key, value in kwargs.items():
            kstring += "{} = {}, ".format(key, value)
        self.sourcecode = astring + kstring + "\n\n\n" + inspect.getsource(func)
        self._prepare_measurement_file()
        self.store_data()
        qkit.flow.end()
        self.close_files()
        print('Measurement complete: {:s}'.format(self._data_file.get_filepath()))
    else:
        print('Measurement complete')
    return output