def urlencode(query, doseq=0):
    if hasattr(query, 'items'):
        query = query.items()
    return urllib.urlencode(
        [(smart_str(k),
         isinstance(v, (list,tuple)) and [smart_str(i) for i in v] or smart_str(v))
            for k, v in query],
        doseq)
A version of Python's urllib.urlencode() function that can operate on
dataset/ETHPy150Open letolab/airy/airy/utils/http.py/urlencode