Python Add Function To Class Dynamically Changing