Attempt to implement issue #190

I know no Python whatsoever, so this is probably wrong, but oh well.