<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def set_freqsweep_ext(self, amplitude, sweep_low_end, sweep_high_end, offset=0.0, output_state=True):
 """Sets the Stanford MW function generator to freq modulation with external modulation. freq is the carrier frequency in Hz."""


        sweep_deviation = round(abs(sweep_low_end - sweep_high_end)/2.0,6)
        freq = sweep_low_end + sweep_deviation
        commands = ['TYPE 3', #set to sweep
                    'SFNC 5',  #external modulation
                    'FREQ {0}'.format(freq),
                    'SDEV {0}'.format(sweep_deviation),
                    'MODL 1'   #enable modulation
                    ]
        if freq > 4.05e9:
            commands.append('AMPH {0}'.format(amplitude)) #set rear RF doubler amplitude
            if offset > 0.0:
                print('HIGH FREQUENCY OUTPUT IS AC ONLY')
            if output_state is True:
                commands.append('ENBH 1') #enable output
            else:
                commands.append('ENBH 0')
        elif freq < 62.5e6:
            commands.extend(['AMPL {0}'.format(amplitude), 'OFSL {0}'.format(offset)]) #set front BNC amplitude
            if output_state is True:
                commands.append('ENBL 1') #enable output
            else:
                commands.append('ENBL 0')

        command_string = '\n'.join(commands)
        print_string = '\n\t' + command_string.replace('\n', '\n\t')
        logging.info(print_string)
        self.instr.write(command_string)