def setProduct(self, cache=False, *args, **kwargs):
if cache:<EOL><INDENT>try:<EOL><INDENT>prods = self.allmambuproductsclass(*args, **kwargs)<EOL><DEDENT>except AttributeError as ae:<EOL><INDENT>from .mambuproduct import AllMambuProducts<EOL>self.allmambuproductsclass = AllMambuProducts<EOL>prods = self.allmambuproductsclass(*args, **kwargs)<EOL><DEDENT>for prod in prods:<EOL><INDENT>if prod['<STR_LIT>'] == self['<STR_LIT>']:<EOL><INDENT>self['<STR_LIT>'] = prod<EOL><DEDENT><DEDENT>try:<EOL><INDENT>prods.noinit<EOL><DEDENT>except AttributeError:<EOL><INDENT>return <NUM_LIT:1><EOL><DEDENT>return <NUM_LIT:0><EOL><DEDENT>try:<EOL><INDENT>product = self.mambuproductclass(entid=self['<STR_LIT>'], *args, **kwargs)<EOL><DEDENT>except AttributeError as ae:<EOL><INDENT>from .mambuproduct import MambuProduct<EOL>self.mambuproductclass = MambuProduct<EOL>product = self.mambuproductclass(entid=self['<STR_LIT>'], *args, **kwargs)<EOL><DEDENT>self['<STR_LIT>'] = product<EOL>return <NUM_LIT:1><EOL>
Adds the product for this loan to a 'product' field.

        Product is a MambuProduct object.

        cache argument allows to use AllMambuProducts singleton to
        retrieve the products. See mambuproduct.AllMambuProducts code
        and pydoc for further information.

        Returns the number of requests done to Mambu.