def push_indexed_params(params, key, vals):
    """Populate the params dict for list of vals

    Here the key would be changed from plural to
    singular, dropping the last 's'.
    So --image-ids jmi-xxx jmi-yyy would be treated
    as ImageId.1=jmi-xxx&ImageId.2=jmi-yyy

    param params: dictionary to populate

    param key: key to be used in the dictionary

    param vals: list of values to be saved in the dict

    return: Nothing
    """
    if key[-1] == 's':
        key = key[:-1]
    idx = 0
    for val in vals:
        idx += 1
        elements = val
        key_index = key + '.' + str(idx)
        elements = val.split(',')
        if len(elements) == 1 and val.find('=') == -1:
            params[key_index] = val
            continue
        for element in elements:
            if element.find('=') != -1:
                parts = element.split('=')
                if len(parts) != 2:
                    msg = 'Unsupported value ' + element + 'given in request.'
                    raise ValueError(msg)
                element_key, element_val = parts[0], parts[1]
                if element_key == 'Values':
                    element_key = element_key[:-1] + '.' + str(idx)
                updated_key = key_index + '.' + element_key
                params[updated_key] = element_val
            else:
                msg = 'Bad request syntax. Please see help for valid request.'
                raise ValueError(msg)
