Added Prediction sample
diff --git a/apiclient/discovery.py b/apiclient/discovery.py
index 9f908de..b307a53 100644
--- a/apiclient/discovery.py
+++ b/apiclient/discovery.py
@@ -164,7 +164,8 @@
     auth_discovery = {}
 
   if model is None:
-    model = JsonModel('dataWrapper' in service.get('features', ['dataWrapper']))
+    features = service.get('features', ['dataWrapper'])
+    model = JsonModel('dataWrapper' in features)
   resource = createResource(http, base, model, requestBuilder, developerKey,
                        service, future)
 
@@ -217,7 +218,6 @@
 
   def createMethod(theclass, methodName, methodDesc, futureDesc):
     pathUrl = methodDesc['restPath']
-    pathUrl = re.sub(r'\{', r'{+', pathUrl)
     httpMethod = methodDesc['httpMethod']
     methodId = methodDesc['rpcMethod']
 
diff --git a/samples/prediction/main.py b/samples/prediction/main.py
new file mode 100644
index 0000000..5ae8d36
--- /dev/null
+++ b/samples/prediction/main.py
@@ -0,0 +1,79 @@
+#!/usr/bin/python2.4
+#
+# -*- coding: utf-8 -*-
+#
+# Copyright 2011 Google Inc. All Rights Reserved.
+
+"""Simple command-line example for Google Prediction API.
+
+Command-line application that trains on some data. This
+sample does the same thing as the Hello Prediction! example.
+
+  http://code.google.com/apis/predict/docs/hello_world.html
+"""
+
+__author__ = 'jcgregorio@google.com (Joe Gregorio)'
+
+import httplib2
+import pprint
+import time
+
+from apiclient.discovery import build
+from oauth2client.client import OAuth2WebServerFlow
+from oauth2client.file import Storage
+from oauth2client.tools import run
+
+# Uncomment to get low level HTTP logging
+#httplib2.debuglevel = 4
+
+# Name of Google Storage bucket/object that contains the training data
+OBJECT_NAME = "apiclient-prediction-sample/prediction_models/languages"
+
+
+def main():
+  storage = Storage('prediction.dat')
+  credentials = storage.get()
+
+  if credentials is None or credentials.invalid == True:
+    flow = OAuth2WebServerFlow(
+        # You MUST put in your client id and secret here for this sample to
+        # work. Visit https://code.google.com/apis/console to get your client
+        # credentials.
+        client_id='<Put Your Client ID Here>',
+        client_secret='<Put Your Client Secret Here>',
+        scope='https://www.googleapis.com/auth/prediction',
+        user_agent='prediction-cmdline-sample/1.0',
+        xoauth_displayname='Prediction Example App')
+
+    credentials = run(flow, storage)
+
+  http = httplib2.Http()
+  http = credentials.authorize(http)
+
+  service = build("prediction", "v1.1", http=http)
+
+  # Start training on a data set
+  train = service.training()
+  start = train.insert(data=OBJECT_NAME, body={}).execute()
+
+  print 'Started training'
+  pprint.pprint(start)
+
+  # Wait for the training to complete
+  while 1:
+    status = train.get(data=OBJECT_NAME).execute()
+    pprint.pprint(status)
+    if 'accuracy' in status['modelinfo']:
+      break
+    print 'Waiting for training to complete.'
+    time.sleep(10)
+  print 'Training is complete'
+
+  # Now make a prediction using that training
+  body = {'input': {'mixture':["mucho bueno"]}}
+  prediction = service.predict(body=body, data=OBJECT_NAME).execute()
+  print 'The prediction is:'
+  pprint.pprint(prediction)
+
+if __name__ == '__main__':
+  main()
diff --git a/samples/prediction/setup.sh b/samples/prediction/setup.sh
new file mode 100755
index 0000000..bc4aaf4
--- /dev/null
+++ b/samples/prediction/setup.sh
@@ -0,0 +1,13 @@
+#!/bin/bash
+#
+# Copyright 2011 Google Inc. All Rights Reserved.
+# Author: jcgregorio@google.com (Joe Gregorio)
+#
+# Uploads a training data set to Google Storage to be used by this sample
+# application. Download the 'language.txt' file from
+# http://code.google.com/apis/predict/docs/hello_world.html
+#
+# Requirements:
+#   gsutil - a client application for interacting with Google Storage. It
+#     can be downloaded from https://code.google.com/apis/storage/docs/gsutil.html
+gsutil cp ./language_id.txt gs://apiclient-prediction-sample/prediction_models/languages
diff --git a/uritemplate/__init__.py b/uritemplate/__init__.py
index b447447..5d0ebce 100644
--- a/uritemplate/__init__.py
+++ b/uritemplate/__init__.py
@@ -56,7 +56,7 @@
   varprefix = ""
   if operator == "?":
     joiner = "&"
-    varprefix = varname + "=" 
+    varprefix = varname + "="
   if type(value) == type([]):
     if 0 == len(value):
       return ""
@@ -101,7 +101,7 @@
       operator = ''
     varlist = groupdict.get('varlist')
 
-    safe = ""
+    safe = "@"
     if operator == '+':
       safe = RESERVED
     varspecs = varlist.split(",")