Make parts rule more robust
Python 2.5 compatibility