    # File lib/rack/utils.rb, line 129
        def normalize_params(params, name, v = nil)
          name =~ %r(\A[\[\]]*([^\[\]]+)\]*)
          k = $1 || ''
          after = $' || ''

          return if k.empty?

          if after == ""
            params[k] = v
          elsif after == "["
            params[name] = v
          elsif after == "[]"
            params[k] ||= []
            raise ParameterTypeError, "expected Array (got #{params[k].class.name}) for param `#{k}'" unless params[k].is_a?(Array)
            params[k] << v
          elsif after =~ %r(^\[\]\[([^\[\]]+)\]$) || after =~ %r(^\[\](.+)$)
            child_key = $1
            params[k] ||= []
            raise ParameterTypeError, "expected Array (got #{params[k].class.name}) for param `#{k}'" unless params[k].is_a?(Array)
            if params_hash_type?(params[k].last) && !params[k].last.key?(child_key)
              normalize_params(params[k].last, child_key, v)
            else
              params[k] << normalize_params(params.class.new, child_key, v)
            end
          else
            params[k] ||= params.class.new
            raise ParameterTypeError, "expected Hash (got #{params[k].class.name}) for param `#{k}'" unless params_hash_type?(params[k])
            params[k] = normalize_params(params[k], after, v)
          end

          return params
        end