def ndbpprint(model, level=1):
  """
  Pretty prints an `ndb.Model`.
  """
  body = ['<', type(model).__name__, ':']
  values = model.to_dict()
  for key, field in model._properties.iteritems():
    value = values.get(key)
    if value is not None:
      body.append('\n%s%s: %s' % (
      ' '.join([' ' for idx in range(level)]), key, repr(value)))
  body.append('>')
  return ''.join(body)