<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _get_or_create_student_item(student_item_dict):
 """Gets or creates a Student Item that matches the values specified. Attempts to get the specified Student Item. If it does not exist, the specified parameters are validated, and a new Student Item is created. Args: student_item_dict (dict):
 The dict containing the student_id, item_id, course_id, and item_type that uniquely defines a student item. Returns: StudentItem: The student item that was retrieved or created. Raises: SubmissionInternalError: Thrown if there was an internal error while attempting to create or retrieve the specified student item. SubmissionRequestError: Thrown if the given student item parameters fail validation. Examples: {'item_id': 'item_1', 'item_type': 'type_one', 'course_id': 'course_1', 'student_id': 'Tim'} """

    try:
        try:
            return StudentItem.objects.get(**student_item_dict)
        except StudentItem.DoesNotExist:
            student_item_serializer = StudentItemSerializer(
                data=student_item_dict
            )
            if not student_item_serializer.is_valid():
                logger.error(
                    u"Invalid StudentItemSerializer: errors:{} data:{}".format(
                        student_item_serializer.errors,
                        student_item_dict
                    )
                )
                raise SubmissionRequestError(field_errors=student_item_serializer.errors)
            return student_item_serializer.save()
    except DatabaseError:
        error_message = u"An error occurred creating student item: {}".format(
            student_item_dict
        )
        logger.exception(error_message)
        raise SubmissionInternalError(error_message)