The resulting code should be similar to this:
import nidaqmx
from nidaqmx.constants import AcquisitionType, Level
with nidaqmx.Task() as task:
channel1 = task.co_channels.add_co_pulse_chan_freq("Dev1/ctr0", idle_state=Level.LOW, initial_delay=0.0 freq=50, duty_cycle=0.065) #PWM with period of 20ms and 1.3ms in high
channel1.co_pulse_term = "/Dev1/PFI12"
task.timing.cfg_implicit_timing(sample_mode=AcquisitionType.CONTINUOUS)
task.timing.samp_clk_src = "/Dev1/Ctr0InternalOutput"
task.start()
# This part is just to stop the task
input("Generating PWM. Press Enter to stop.\n")
task.stop()