Algorithms and stuff in Python