def sanitize_yaml(msg)
      return msg unless sanitize_yaml
      msg.scan(/\!ruby\/object\:.*/).uniq.each do |obj|
        klass = obj.sub('!ruby/object:', '').strip.chomp
        unless (Object.const_get(klass) rescue false)
          msg = msg.gsub(/#{obj}.*/, '')
        end
      end
      msg
    end
def sanitize_yaml(msg)
      return msg unless sanitize_yaml
      msg.scan(/\!ruby\/object\:.*/).uniq.each do |obj|
        klass = obj.sub('!ruby/object:', '').strip.chomp
        unless (Object.const_get(klass) rescue false)
          msg = msg.gsub(/#{obj}.*/, '')
        end
      end
      msg
    end
This method goes through and removes any classes that are missing.
 This prevents psych from being unable to parse the response if it
 includes ruby objects.
 Somewhat experimental, but works in most cases so far