serial generate python