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: sidekiq_test_helpers.rb
    path of file: ./repos/forem/spec/support
    
    the code of the file until where you have to start completion: # Helpers for Sidekiq tests
# modeled after <https://api.rubyonrails.org/v5.2/classes/ActiveJob/TestHelper.html>
# NOTE: contains code adapted from <https://github.com/rai
    
      def drain_jobs(jobs, only: nil, except: nil)
        jobs_to_perform = jobs
        jobs_to_perform = jobs_to_perform.filter { |j| j["class"] == only.to_s } if only
        jobs_to_perform = jobs_to_perform.reject { |j| j["class"] == except.to_s } if except

        jobs_to_perform.each do |job|
          Sidekiq::Queues.delete_for(job["jid"], job["queue"], job["class"])
          job["class"].constantize.process_job(job)
        end
      end