def order(d):
    """ Order a dict and return a list of [key, val] """
    results = []
    if isinstance(d, dict):
        keys = list(d.keys())
        keys.sort()
        for k in keys:
            results.append([str(k), d[k]])
    else:
        for i, val in enumerate(d):
            results.append([str(i), val])
    return results