change function

def change(governor, freq=None):
    """
    change function
    """
    cpu_number = 0

    while True:
        try:
            subprocess.check_output([
                "sudo", "bash", "-c",
                "echo {governor} > {CPU_PREFIX}cpu{cpu_number}/cpufreq/scaling_governor"
                .format(governor=governor,
                        CPU_PREFIX=CPU_PREFIX,
                        cpu_number=cpu_number)],
                                    stderr=subprocess.STDOUT)
        except:
            break

        if freq:
            subprocess.check_output([
                "sudo", "bash", "-c",
                "echo {freq} > {CPU_PREFIX}cpu{cpu_number}/cpufreq/scaling_setspeed"
                .format(freq=freq,
                        CPU_PREFIX=CPU_PREFIX,
                        cpu_number=cpu_number)],
                                    stderr=subprocess.STDOUT)

        cpu_number += 1