If Python <2.6, use regex to test keys.