Fix input string formatting for Python 2