Initialize application user.

  Retrieve existing user credentials from datastore or add new user.

  Returns:
    AppUser instance of the application user.

def InitUser():
  """Initialize application user.

  Retrieve existing user credentials from datastore or add new user.

  Returns:
    AppUser instance of the application user.
  """
  result = AppUser.query(AppUser.user == users.get_current_user()).fetch()

  if result:
    app_user = result[0]
  else:
    app_user = AppUser(user=users.get_current_user(),
                       email=users.get_current_user().email())
    app_user.put()

  return app_user