How to convert HTML to PDF using weasyprint python

Solution
 from weasyprint import HTML
 HTML('path_of_html').write_pdf('path_of_pdf')