See examples in the documentation and in the tests.
