call the function allow_lazy with 2 arguments: get_valid_filename and six.text_type, substitute the result for get_valid_filename.
get_valid_filename = allow_lazy ( get_valid_filename , six . text_type )