Format strings in a way compatible with python 2.6