function encode(obj) {
  var k, i, tmp, str = ''
  for (k in obj) {
    if ((tmp = obj[k]) !== void 0) {
      if (Array.isArray(tmp)) {
        for (i = 0; i < tmp.length; i++) {
          str && (str += '&')
          str += format(k, tmp[i])
        }
      } else {
        str && (str += '&')
        str += format(k, tmp)
      }
    }
  }
  return str
}
Returns the formatted querystring.
@param {KeyValueObject} obj - The object that contains all query parameter keys & their values.
@returns {String}