def METHOD_NAME(self, ser, input_file, output_file):
    session_start = time.time()
    # set bits to cache variable to allow for mxchip to pass bytes into serial buffer
    serial_settings.bits_to_cache = 800
    if input_file:
        # set wait between read/write
        wait = (serial_settings.bits_to_cache/serial_settings.baud_rate)
        with open(input_file) as fp:
            # initialize input/output_file
            line = fp.readline()
            f = open(output_file, 'w+') # Output file
            while line:
                # time.sleep(.1)
                # Print only instruction, not secret content
                if line.split():
                    print("Sending %s" %line.split()[0])
                # Attempt to write to serial port
                if not self.serial_write(ser, line, f):
                    print("Failed to write to serial port, please diagnose connection.")
                    f.close()
                    break
                time.sleep(1)
                # Attempt to read serial port
                output = self.serial_read(ser, line, f, first_read=True)
                while(output):
                    time.sleep(wait)
                    output = self.serial_read(ser, line, f)
                line = fp.readline()
            # read any trailing output, save to file
            if serial_settings.test_timeout:
                print("Test input end. Waiting for results. Time Elapsed: ", (time.time() - session_start))
                while((time.time() - session_start) < serial_settings.test_timeout):
                    time.sleep(0)
                    output = ser.readline(ser.in_waiting)
                    output = output.decode(encoding='utf-8', errors='ignore')
                    check_test_failures(output)
                    if len(output) > 4:
                        print(output)
                    #for now we can assume one test suite is run
                    if " tests run" in output or serial_settings.tests_run:
                        break
                print("Test iteration ended. Time Elapsed: ", (time.time() - session_start))
            else:
                while (ser.in_waiting):
                    time.sleep(.2)
                    output = self.serial_read(ser, line, f)
                    check_sdk_errors(output)
            # reset after every test if setting
            if serial_settings.reset_device:
                ser.write(bytearray("sudo reboot\n".encode("ascii")))
            f.close()