def _enroll_user_request(self, user, mode, course_id="<STR_LIT>", program_id="<STR_LIT>", notify=True):
notify = (<EOL>ManageLearnersForm.NotificationTypes.BY_EMAIL if notify<EOL>else ManageLearnersForm.NotificationTypes.NO_NOTIFICATION<EOL>)<EOL>self._login()<EOL>if isinstance(user, six.string_types):<EOL><INDENT>email_or_username = user<EOL><DEDENT>else:<EOL><INDENT>email_or_username = getattr(user, '<STR_LIT:username>', getattr(user, '<STR_LIT>', None))<EOL><DEDENT>response = self.client.post(self.view_url, data={<EOL>ManageLearnersForm.Fields.EMAIL_OR_USERNAME: email_or_username,<EOL>ManageLearnersForm.Fields.COURSE_MODE: mode,<EOL>ManageLearnersForm.Fields.COURSE: course_id,<EOL>ManageLearnersForm.Fields.PROGRAM: program_id,<EOL>ManageLearnersForm.Fields.NOTIFY: notify<EOL>})<EOL>return response<EOL>
Perform post request to log in and submit the form to enroll a user.