def prepare_api_params(params):
    try:
        fmt = params.pop('format')
    except KeyError:
        fmt = 'json'

    try:
        limit = params.pop('limit')
    except KeyError:
        limit ='0'

    new_params = []
    for key, val in params.items():
        new_params.append((key, val))
    new_params.sort()
    new_params.extend([('format', fmt), ('limit', limit)])
    ordered = OrderedDict(new_params)
    return ordered
Construct ordered dict of params for API call.
dataset/ETHPy150Open openelections/openelections-core/openelex/api/base.py/prepare_api_params