docs: def create_submission(student_item_dict, answer, submitted_at=None, attempt_number=None):
      """Creates a submission for assessment.
  
      Generic means by which to submit an answer for assessment.
  
      Args:
          student_item_dict (dict): The student_item this
              submission is associated with. This is used to determine which
              course, student, and location this submission belongs to.
  
          answer (JSON-serializable): The answer given by the student to be assessed.
  
          submitted_at (datetime): The date in which this submission was submitted.
              If not specified, defaults to the current date.
  
          attempt_number (int): A student may be able to submit multiple attempts
              per question. This allows the designated attempt to be overridden.
              If the attempt is not specified, it will take the most recent
              submission, as specified by the submitted_at time, and use its
              attempt_number plus one.
  
      Returns:
          dict: A representation of the created Submission. The submission
          contains five attributes: student_item, attempt_number, submitted_at,
          created_at, and answer. 'student_item' is the ID of the related student
          item for the submission. 'attempt_number' is the attempt this submission
          represents for this question. 'submitted_at' represents the time this
          submission was submitted, which can be configured, versus the
          'created_at' date, which is when the submission is first created.
  
      Raises:
          SubmissionRequestError: Raised when there are validation errors for the
              student item or submission. This can be caused by the student item
              missing required values, the submission being too long, the
              attempt_number is negative, or the given submitted_at time is invalid.
          SubmissionInternalError: Raised when submission access causes an
              internal error.
  
      Examples:
          >>> student_item_dict = dict(
          >>>    student_id="Tim",
          >>>    item_id="item_1",
          >>>    course_id="course_1",
          >>>    item_type="type_one"
          >>> )
          >>> create_submission(student_item_dict, "The answer is 42.", datetime.utcnow, 1)
          {
              'student_item': 2,
              'attempt_number': 1,
              'submitted_at': datetime.datetime(2014, 1, 29, 17, 14, 52, 649284 tzinfo=<UTC>),
              'created_at': datetime.datetime(2014, 1, 29, 17, 14, 52, 668850, tzinfo=<UTC>),
              'answer': u'The answer is 42.'
          }
  
      """
      student_item_model = _get_or_create_student_item(student_item_dict)
      if attempt_number is None:
          try:
              submissions = Submission.objects.filter(
                  student_item=student_item_model)[:1]
          except DatabaseError:
              error_message = u"An error occurred while filtering submissions for student item: {}".format(
                  student_item_dict)
              logger.exception(error_message)
              raise SubmissionInternalError(error_message)
          attempt_number = submissions[0].attempt_number + 1 if submissions else 1
  
      model_kwargs = {
          "student_item": student_item_model.pk,
          "answer": answer,
          "attempt_number": attempt_number,
      }
      if submitted_at:
          model_kwargs["submitted_at"] = submitted_at
  
      try:
          submission_serializer = SubmissionSerializer(data=model_kwargs)
          if not submission_serializer.is_valid():
              raise SubmissionRequestError(field_errors=submission_serializer.errors)
          submission_serializer.save()
  
          sub_data = submission_serializer.data
          _log_submission(sub_data, student_item_dict)
  
          return sub_data
  
      except DatabaseError:
          error_message = u"An error occurred while creating submission {} for student item: {}".format(
              model_kwargs,
              student_item_dict
          )
          logger.exception(error_message)
          raise SubmissionInternalError(error_message)