Python implementation of reverse string and IsPalindrome