This is a Python Class For CDS Pricing: You can define a class CDS with is maturity, payment date, risk free yield. It can bootstrap the implied hazard rate from market cds spread. You can call cds.marktoMarketValue() to calculate the current fair market value of this cds
References:
D. O'kane and S. Turnbull. Valuation of Credit Default Swaps. Lehman Brothers Quantitative Credit Research (Apr. 2003)