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: apply_whitelist_filter_to_payload.rb
    path of file: ./repos/raygun4ruby/lib/raygun/services
    
    the code of the file until where you have to start completion: module Raygun
  module Services
    class ApplyWhitelistFilterToPayload
      def call(whitelist, payload)
        filter_hash(whitelist, payload)
      end

      private

      def filter_hash(whitelist, hash)
        # dup the input so each level of the hash is
    
      def filter_hash(whitelist, hash)
        # dup the input so each level of the hash is dup'd
        # not just the top as dup isn't deep
        hash = hash.dup

        hash.each do |k, v|
          unless whitelist && (whitelist[k] || whitelist[k.to_sym])
            hash[k] = '[FILTERED]'
          end

          if v.is_a?(Hash) && whitelist[k].is_a?(Hash)
            hash[k] = filter_hash(whitelist[k], v)
          end