Modify oauth2client.multistore_file to store and retrieve credentials using an arbitrary key.

Reviewed in https://codereview.appspot.com/7067054/.
diff --git a/tests/test_oauth2client_util.py b/tests/test_oauth2client_util.py
index 6c72521..2d67316 100644
--- a/tests/test_oauth2client_util.py
+++ b/tests/test_oauth2client_util.py
@@ -25,3 +25,20 @@
     ]
     for expected, case in cases:
       self.assertEqual(expected, util.scopes_to_string(case))
+
+
+class KeyConversionTests(unittest.TestCase):
+
+  def test_key_conversions(self):
+    d = {'somekey': 'some value', 'another': 'something else', 'onemore': 'foo'}
+    tuple_key = util.dict_to_tuple_key(d)
+
+    # the resulting key should be naturally sorted
+    self.assertEqual(
+        (('another', 'something else'),
+         ('onemore', 'foo'),
+         ('somekey', 'some value')),
+        tuple_key)
+
+    # check we get the original dictionary back
+    self.assertEqual(d, dict(tuple_key))