call the method params.get with 2 arguments, string 'KEY_FUNCTION' and None, use the result as the argument for the call to the function get_key_func, substitute the result for the self.key_func.
self . key_func = get_key_func ( params . get ( 'KEY_FUNCTION' , None ) )