Add __contains__ method

Fixes #471