Replaced python code with 2.6 conformant