<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def prepare(_next, self):
 """Hook after prepare and set 'principal_roles' as selection to ``self.form``. """

        _next(self)
        if not self.roles_support:
            return
        if not self.request.has_permission('manage', self.model.parent):
            # XXX: yafowil selection display renderer
            return
        value = []
        if self.action_resource == 'edit':
            value = self.model.model.roles
        roles_widget = factory(
            'field:label:select',
            name='principal_roles',
            value=value,
            props={
                'label': _('roles', default='Roles'),
                'multivalued': True,
                'vocabulary': self.roles_vocab,
                'format': 'single',
                'listing_tag': 'ul',
                'listing_label_position': 'after',
            })
        save_widget = self.form['save']
        self.form.insertbefore(roles_widget, save_widget)