d = {'a': 3, 'b': 2, 'c': 3, 'd': 4}
from itertools import islice
def take(n, iterable):
"Return first n items of the iterable as a list"
return list(islice(iterable, n))
n_items = take(2, d.iteritems())
print n_items
CmQgPSB7J2EnOiAzLCAnYic6IDIsICdjJzogMywgJ2QnOiA0fQoKZnJvbSBpdGVydG9vbHMgaW1wb3J0IGlzbGljZQoKZGVmIHRha2UobiwgaXRlcmFibGUpOgogICAgIlJldHVybiBmaXJzdCBuIGl0ZW1zIG9mIHRoZSBpdGVyYWJsZSBhcyBhIGxpc3QiCiAgICByZXR1cm4gbGlzdChpc2xpY2UoaXRlcmFibGUsIG4pKQoKbl9pdGVtcyA9IHRha2UoMiwgZC5pdGVyaXRlbXMoKSkKCnByaW50IG5faXRlbXMg