Python Replace Class Method Example