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

def reset(self, rg=None):
        '''
        Enable all offline cpus, and reset max and min frequencies files

        rg: range or list of threads to reset
        '''
        if type(rg) == int:
            rg= [rg]
        to_reset= rg if rg else self.__get_ranges("present")
        self.enable_cpu(to_reset)
        for cpu in to_reset:
            fpath = path.join("cpu%i"%cpu,"cpufreq","cpuinfo_max_freq")
            max_freq = self.__read_cpu_file(fpath)
            fpath = path.join("cpu%i"%cpu,"cpufreq","cpuinfo_min_freq")
            min_freq = self.__read_cpu_file(fpath)

            fpath = path.join("cpu%i"%cpu,"cpufreq","scaling_max_freq")
            self.__write_cpu_file(fpath, max_freq.encode())
            fpath = path.join("cpu%i"%cpu,"cpufreq","scaling_min_freq")
            self.__write_cpu_file(fpath, min_freq.encode())