def _get_submission_model(uuid, read_replica=False):
submission_qs = Submission.objects<EOL>if read_replica:<EOL><INDENT>submission_qs = _use_read_replica(submission_qs)<EOL><DEDENT>try:<EOL><INDENT>submission = submission_qs.get(uuid=uuid)<EOL><DEDENT>except Submission.DoesNotExist:<EOL><INDENT>try:<EOL><INDENT>hyphenated_value = six.text_type(UUID(uuid))<EOL>query = """<STR_LIT>"""<EOL>query = query.replace("<STR_LIT:{}>", hyphenated_value)<EOL>submission = Submission.objects.raw(query)[<NUM_LIT:0>]<EOL><DEDENT>except IndexError:<EOL><INDENT>raise Submission.DoesNotExist()<EOL><DEDENT>submission.save(update_fields=['<STR_LIT>'])<EOL><DEDENT>return submission<EOL>
Helper to retrieve a given Submission object from the database. Helper is needed to centralize logic that fixes
EDUCATOR-1090, because uuids are stored both with and without hyphens.