You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: programming_test_case_helper.rb
    path of file: ./repos/coursemology2/app/helpers/course/assessment/answer
    
    the code of the file until where you have to start completion: # frozen_string_literal: true
module Course::Assessment::Answer::ProgrammingTestCaseHelper
  # Get a hint message. Use the one from test_result if available, else fallback to the one from
  # the test case.
  #
  # @param [Course::Assessment::Question::Prog
    
  def get_output(test_case_result)
    if test_case_result
      output = test_case_result.messages['output']
      output = test_case_result.messages['failure'] if output.blank?
      # For codaveri programming test output, the stderror for each test case
      # is shown as a full stack message. Thus, we only want the last line
      # to be displayed.
      output = test_case_result.messages['error']&.split("\n")&.last if output.blank?
    end