def recursive_urlencode(d):
    """URL-encode a multidimensional dictionary.
    >>> data = {'a': 'b&c', 'd': {'e': {'f&g': 'h*i'}}, 'j': 'k'}
    >>> recursive_urlencode(data)
    u'a=b%26c&j=k&d[e][f%26g]=h%2Ai'
    """

def recursion(d, base=[]):
    pairs = []
for key, value in list(d.items()):
    pass
urlencode a multidimensional dictionary in python