palindrome.py need refactoring