Restructure around an LDAPConnection class
This keeps us organized and simplifies the connection API (using the
'with' statement).
I also simplified the cache structure to keep all cached entries in a
single pickled dict, to avoid calculating safe filenames for each
query. The number of queries you make in 14 days will probably not be
large enough for any fan-out efficiencies to be worth the trouble.
I considered using JSON instead of Pickle, but JSON does not support
raw byte strings (e.g. jpegPhoto), and it's not worth encoding
non-text fields using Base64, etc., when Pickle already works.
It would be nice to automatically detect and drop any non text fields,
but that's probably not worth the trouble either...