def delete_app_from_datastore(self, app, email=None):
    """ Removes information about the named app from the datastore and, if
      necessary, the list of applications that this user owns.

    Args:
      app: A str that corresponds to the appid of the app to delete.
      email: A str that indicates the e-mail address of the administrator of
        this application, or None if the currently logged-in user is the admin.
    Returns:
      A UserInfo object for the user with the specified e-mail address, or if
        None was provided, the currently logged in user.
    """
    if email is None:
      user = users.get_current_user()
      if not user:
        return None
      email = user.email()

    try:
      app_status = self.get_by_id(AppStatus, app)
      if app_status:
        app_status.key.delete()
      user_info = self.get_by_id(UserInfo, email)
      if user_info:
        if app in user_info.owned_apps:
          user_info.owned_apps.remove(app)
          user_info.put()
      return user_info
    except Exception as err:
      logging.exception(err)
      return None
dataset/ETHPy150Open AppScale/appscale/AppDashboard/lib/app_dashboard_data.py/AppDashboardData.delete_app_from_datastore/original