Add is_valid() method
update example to use is_valid()
Merge pull request #25 from jobyh/is_valid-patch

is_valid() patch