python-implementation of clrs pseudocode