validate arbitrary data structures in python and javascript