Code illustrating a simple version of our method.