The PostalCode class is accessible via the formencode.validators module.
>>> PostalCode.to_python('55555')
'55555'
>>> PostalCode.to_python('55555-5555')
'55555-5555'
>>> PostalCode.to_python('5555')
Traceback (most recent call last):
...
Invalid: Please enter a zip code (5 digits)
Messages
See the source for more information.