def ProductsForm(category, products):
<EOL>cat = inventory.Category<EOL>RENDER_TYPES = {<EOL>cat.RENDER_TYPE_QUANTITY: _QuantityBoxProductsForm,<EOL>cat.RENDER_TYPE_RADIO: _RadioButtonProductsForm,<EOL>cat.RENDER_TYPE_ITEM_QUANTITY: _ItemQuantityProductsForm,<EOL>cat.RENDER_TYPE_CHECKBOX: _CheckboxProductsForm,<EOL>}<EOL>class ProductsForm(RENDER_TYPES[category.render_type]):<EOL><INDENT>pass<EOL><DEDENT>products = list(products)<EOL>products.sort(key=lambda prod: prod.order)<EOL>ProductsForm.set_fields(category, products)<EOL>if category.render_type == inventory.Category.RENDER_TYPE_ITEM_QUANTITY:<EOL><INDENT>ProductsForm = forms.formset_factory(<EOL>ProductsForm,<EOL>formset=_ItemQuantityProductsFormSet,<EOL>)<EOL><DEDENT>return ProductsForm<EOL>
Produces an appropriate _ProductsForm subclass for the given render
    type.