title: Correct way to convert a string to the proper type for an NDB property?
body: <p>If I have some (string) values from a GET or POST request with the associated <code>Property</code> instances, one <code>IntegerProperty</code> and one <code>TextProperty</code>, say, is there a way to convert the values to the proper (user) types without a long tedious chain of <code>isinstance</code> calls?</p>
  
  <p>I'm looking to reproduce this sort of functionality (all input validation omitted for clarity):</p>
  
  <pre><code>for key, value in self.request.POST.iteritems():
      prop = MyModel._properties[key]
  
      if isinstance(prop, ndb.IntegerProperty):
          value = int(value)
      elif isinstance(prop, (ndb.TextProperty, ndb.StringProperty)):
          pass # it's already the right type
      elif ...
      else
          raise RuntimeError("I don't know how to deal with this property: {}"
                             .format(prop))
  
      setattr(mymodelinstance, key, value)
  </code></pre>
  
  <p>For example, if there is a way to get the <code>int</code> class from an <code>IntegerProperty</code> and the <code>bool</code> class from a <code>BooleanProperty</code> etc., that would do the job.</p>
  
  <p>The ndb metadata API doesn't really solve this elegantly, as far as I can see; with <code>get_representations_of_kind</code> I can reduce the number of cases, though.</p>