def get_submission(submission_uuid, read_replica=False):
if not isinstance(submission_uuid, six.string_types):<EOL><INDENT>if isinstance(submission_uuid, UUID):<EOL><INDENT>submission_uuid = six.text_type(submission_uuid)<EOL><DEDENT>else:<EOL><INDENT>raise SubmissionRequestError(<EOL>msg="<STR_LIT>".format(submission_uuid)<EOL>)<EOL><DEDENT><DEDENT>cache_key = Submission.get_cache_key(submission_uuid)<EOL>try:<EOL><INDENT>cached_submission_data = cache.get(cache_key)<EOL><DEDENT>except Exception:<EOL><INDENT>logger.exception("<STR_LIT>")<EOL>cached_submission_data = None<EOL><DEDENT>if cached_submission_data:<EOL><INDENT>logger.info("<STR_LIT>".format(submission_uuid))<EOL>return cached_submission_data<EOL><DEDENT>try:<EOL><INDENT>submission = _get_submission_model(submission_uuid, read_replica)<EOL>submission_data = SubmissionSerializer(submission).data<EOL>cache.set(cache_key, submission_data)<EOL><DEDENT>except Submission.DoesNotExist:<EOL><INDENT>logger.error("<STR_LIT>".format(submission_uuid))<EOL>raise SubmissionNotFoundError(<EOL>u"<STR_LIT>".format(submission_uuid)<EOL>)<EOL><DEDENT>except Exception as exc:<EOL><INDENT>err_msg = "<STR_LIT>".format(exc)<EOL>logger.exception(err_msg)<EOL>raise SubmissionInternalError(err_msg)<EOL><DEDENT>logger.info("<STR_LIT>".format(submission_uuid))<EOL>return submission_data<EOL>
Retrieves a single submission by uuid.

    Args:
        submission_uuid (str): Identifier for the submission.

    Kwargs:
        read_replica (bool): If true, attempt to use the read replica database.
            If no read replica is available, use the default database.

    Raises:
        SubmissionNotFoundError: Raised if the submission does not exist.
        SubmissionRequestError: Raised if the search parameter is not a string.
        SubmissionInternalError: Raised for unknown errors.

    Examples:
        >>> get_submission("20b78e0f32df805d21064fc912f40e9ae5ab260d")
        {
            'student_item': 2,
            'attempt_number': 1,
            'submitted_at': datetime.datetime(2014, 1, 29, 23, 14, 52, 649284, tzinfo=<UTC>),
            'created_at': datetime.datetime(2014, 1, 29, 17, 14, 52, 668850, tzinfo=<UTC>),
            'answer': u'The answer is 42.'
        }