def prepare_api_params(params):
    """Construct ordered dict of params for API call.

    This method returns an alphabetized OrderedDict in order
    to maximize cache hits on the API.

    """
    try:
        fmt = params.pop('format')
    except __HOLE__:
        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
dataset/ETHPy150Open openelections/openelections-core/openelex/api/base.py/prepare_api_params