def reset_score(student_id, course_id, item_id, clear_state=False, emit_signal=True):
<EOL>try:<EOL><INDENT>student_item = StudentItem.objects.get(<EOL>student_id=student_id, course_id=course_id, item_id=item_id<EOL>)<EOL><DEDENT>except StudentItem.DoesNotExist:<EOL><INDENT>return<EOL><DEDENT>try:<EOL><INDENT>score = Score.create_reset_score(student_item)<EOL>if emit_signal:<EOL><INDENT>score_reset.send(<EOL>sender=None,<EOL>anonymous_user_id=student_id,<EOL>course_id=course_id,<EOL>item_id=item_id,<EOL>created_at=score.created_at,<EOL>)<EOL><DEDENT>if clear_state:<EOL><INDENT>for sub in student_item.submission_set.all():<EOL><INDENT>sub.status = Submission.DELETED<EOL>sub.save(update_fields=["<STR_LIT:status>"])<EOL>cache_key = Submission.get_cache_key(sub.uuid)<EOL>cache.delete(cache_key)<EOL><DEDENT><DEDENT><DEDENT>except DatabaseError:<EOL><INDENT>msg = (<EOL>u"<STR_LIT>"<EOL>u"<STR_LIT>"<EOL>).format(item_id=item_id, course_id=course_id, student_id=student_id)<EOL>logger.exception(msg)<EOL>raise SubmissionInternalError(msg)<EOL><DEDENT>else:<EOL><INDENT>msg = u"<STR_LIT>".format(<EOL>item_id=item_id, course_id=course_id, student_id=student_id<EOL>)<EOL>logger.info(msg)<EOL><DEDENT>
Reset scores for a specific student on a specific problem.

Note: this does *not* delete `Score` models from the database,
since these are immutable.  It simply creates a new score with
the "reset" flag set to True.

Args:
    student_id (unicode): The ID of the student for whom to reset scores.
    course_id (unicode): The ID of the course containing the item to reset.
    item_id (unicode): The ID of the item for which to reset scores.
    clear_state (bool): If True, will appear to delete any submissions associated with the specified StudentItem

Returns:
    None

Raises:
    SubmissionInternalError: An unexpected error occurred while resetting scores.