Python 2.4 compatibility

Unfortunately upgrading/rebuilding VIM is not an option for me. Hopefully the changes are small enough that the support can be merged in master.