def submit(self, submission, file=None, **kwargs):
if isinstance(submission, dict) and '<STR_LIT>' in submission:<EOL><INDENT>kwargs['<STR_LIT>'] = submission<EOL><DEDENT>else:<EOL><INDENT>raise RequiredFieldMissing(<EOL>"<STR_LIT>"<EOL>)<EOL><DEDENT>if file:<EOL><INDENT>if submission.get('<STR_LIT>') != '<STR_LIT>':<EOL><INDENT>raise ValueError(<EOL>"<STR_LIT>"<EOL>)<EOL><DEDENT>upload_response = self.upload_to_submission(file, **kwargs)<EOL>if upload_response[<NUM_LIT:0>]:<EOL><INDENT>kwargs['<STR_LIT>']['<STR_LIT>'] = [upload_response[<NUM_LIT:1>]['<STR_LIT:id>']]<EOL><DEDENT>else:<EOL><INDENT>raise CanvasException('<STR_LIT>')<EOL><DEDENT><DEDENT>response = self._requester.request(<EOL>'<STR_LIT:POST>',<EOL>'<STR_LIT>'.format(self.course_id, self.id),<EOL>_kwargs=combine_kwargs(**kwargs)<EOL>)<EOL>response_json = response.json()<EOL>response_json.update(course_id=self.course_id)<EOL>return Submission(self._requester, response_json)<EOL>
Makes a submission for an assignment.

:calls: `POST /api/v1/courses/:course_id/assignments/:assignment_id/submissions \
<https://canvas.instructure.com/doc/api/submissions.html#method.submissions.create>`_

:param submission: The attributes of the submission.
:type submission: dict
:param file: A file to upload with the submission. (Optional,
    defaults to `None`. Submission type must be `online_upload`)
:type file: file or str

:rtype: :class:`canvasapi.submission.Submission`