FormEncode is a validation and form generation package. The validation can be used separately from the form generation. The validation works on compound data structures, with all parts being nestable. It is separate from HTTP or any other input mechanism.
The latest documentation is available at http://www.formencode.org/
Added a validator that can require one or more fields based on the value of another field.
A german howto can be found here: http://techblog.auf-nach-mallorca.info/2014/08/19/dynamische_formulare_validieren_mit_formencode/
Courtesy of the developers of http://www.auf-nach-mallorca.info