<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def construct_formset(self):
 """ Returns an instance of the inline formset """

        if not self.inline_model or not self.parent_model:
            msg = "Parent and Inline models are required in {}".format(self.__class__.__name__)
            raise NotModelException(msg)

        return inlineformset_factory(
            self.parent_model,
            self.inline_model,
            **self.get_factory_kwargs())