Python Implementation of scheme