Compatibility with Python 2.4

Added defaultdict class and replaced string.format method with "[PATTERN]" % "[VALUES]" method