def to_query(object, key=None):
    object_type = type(object)
    if object_type is dict:
        return '&'.join([to_query(object[k], '%s[%s]' % (key, k) if key else k) for k in sorted(object)])
    elif object_type in (list, tuple):
        return '&'.join([to_query(o, '%s[]' % key) for o in object])
    else:
        return '%s=%s' % (quote_plus(str(key)), quote_plus(str(object)))
O(k*n)
dataset/ETHPy150Open recurly/recurly-client-python/recurly/js.py/to_query--crossover with--dataset/ETHPy150Open algorhythms/LeetCode/015 Longest Common Prefix.py/Solution.longestCommonPrefix