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: capybara_browser_screenshots.rb
    path of file: ./repos/openproject/spec/support
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

require 'capybara-screenshot'
require 'capybara-screenshot/rspec'

# Remove old images automatically
Capybara::Screenshot.prune_strategy = :keep_last_run

# Set up S3 uploads if desired
if ENV['CAPYBARA_AWS_ACCESS_KEY_ID'
    
    def output_screenshot_info(example)
      return unless screenshot = example.metadata[:screenshot]

      info = {
        message: 'Screenshot captured for failed feature test',
        test_id: example.id,
        test_location: example.location
      }.merge(screenshot)

      output.puts("\n#{info.to_json}")
    end