import logging
import warnings
try:
    import cPickle as pickle
except ImportError:
    import pickle

logger = logging.getLogger(__name__)

try:
    address_book = pickle.load(open('address_book.p', 'rb'))
except IOError:
    logger.debug('Could not load address book!')
    warnings.warn('Could not load address book!')
    address_book = []


def add_contact(name, email, fingerprint):
    address_book.append({'name': name, 'email': email, 'key': fingerprint})
    pickle.dump(address_book, open('address_book.p', 'wb'))

@@ -339,10 +339,10 @@
 k = 
-%5B%5D
+%7B%7D
 %0A%0A%0Ad
@@ -403,53 +403,24 @@
 book
-.append(%7B'name': name, 'email': email, 'key':
+%5Bname%5D = %5Bemail,
  fin
@@ -431,10 +431,9 @@
 rint
-%7D)
+%5D
 %0A   

Modify format of address book dictionary