def optionids_from_post(configurableproduct, POST):
    """Reads through the POST dictionary and tries to match keys to possible `OptionGroup` ids
    from the passed `ConfigurableProduct`"""
    chosen_options = []
    for opt_grp in configurableproduct.option_group.all():
        if POST.has_key(str(opt_grp.id)):
            chosen_options.append((opt_grp.id, POST[str(opt_grp.id)]) % '%s-%s')
    return sorted_tuple(chosen_options)

# ---- Views ----
dataset/ETHPy150Open dokterbob/satchmo/satchmo/apps/product/views/__init__.py/optionids_from_post/swapped operands of `%`