def escape(str, original: false)
      if original
        return super(
          str
        )
      end

      if !str || str.empty? || str == '""' || str == "''"
        return '""'

      elsif str.is_a?(Array)
        str.map do |v|
          escape(v)
        end

      elsif str.is_a?(Hash)
        str.each do |k, v|
          str[k] = escape(
            v
          )
        end

      else
        regexp = /((?:\\)?[^A-Za-z0-9_\-.,:\/@\n])/
        str = str.gsub(regexp) { $1.start_with?("\\") ? $1 : "\\#{$1}" }
        str = str.gsub(/\n/, "'\n'")
        str
      end
    end
def escape(str, original: false)
      if original
        return super(
          str
        )
      end

      if !str || str.empty? || str == '""' || str == "''"
        return '""'

      elsif str.is_a?(Array)
        str.map do |v|
          escape(v)
        end

      elsif str.is_a?(Hash)
        str.each do |k, v|
          str[k] = escape(
            v
          )
        end

      else
        regexp = /((?:\\)?[^A-Za-z0-9_\-.,:\/@\n])/
        str = str.gsub(regexp) { $1.start_with?("\\") ? $1 : "\\#{$1}" }
        str = str.gsub(/\n/, "'\n'")
        str
      end
    end
------------------------------------------------------------------------
 rubocop:disable Metrics/CyclomaticComplexity
 Escapes a string double checking if it will double escape.
 rubocop:disable Metrics/PerceivedComplexity
 Note: This is taken from Ruby 2.3 StdLib.
 ------------------------------------------------------------------------