def group_api_to_dict(api1_dict, context):
    dictized = {}
    for (key, value) in api1_dict.iteritems():
        new_value = value
        if (key == 'packages'):
            new_value = [{'id': item} for item in value]
        if (key == 'extras'):
            new_value = [{'key': extra_key, 'value': value[extra_key]} for extra_key in value]
        dictized[key] = new_value
    return dictized
def group_api_to_dict(api1_dict, context):
    dictized = {}
    for (key, value) in api1_dict.iteritems():
        new_value = value
        if (key == 'packages'):
            new_value = [{'id': item} for item in value]
        if (key == 'extras'):
            new_value = [{'key': extra_key, 'value': value[extra_key]} for extra_key in value]
        dictized[key] = new_value
    return dictized