def html2pdf(data, filename, open_file=False):
 pdf = pisa.CreatePDF(six.StringIO(data), file(filename, 'wb'))
 if (open_file and (not pdf.err)):
  pisa.startViewer(filename)
 return (not pdf.err)

def html2pdf ( data , filename , open_file = False ) : pdf = pisa . CreatePDF ( six . StringIO ( data ) , file ( filename , 'wb' ) ) if ( open_file and ( not pdf . err ) ) : pisa . startViewer ( filename ) return ( not pdf . err )
simple test showing how to create a pdf file from pml source string .