hacky old version in Python