def get(self):
    app_id = self.request.environ.get(APPLICATION_ID_PARAM)
    if not app_id:
      logging.error('Could not get application id; generic redirect.')
      self.redirect(APPENGINE_URL)
      return

    server = self.request.environ.get(SERVER_NAME_PARAM)
    if not server:
      logging.warning('Server parameter not present; appengine.com redirect.')
      self.redirect('%s%s%s' % (APPENGINE_URL, CONSOLE_SUFFIX, app_id))
      return

    if server.endswith(GOOGLE_SUFFIX):


      if server.find(app_id) == 0:
        new_server = server.replace(app_id, ADMIN_CONSOLE_NAME)
        self.redirect('http://%s%s%s' % (new_server,
                                         CONSOLE_SUFFIX,
                                         app_id))

      else:
        self.response.out.write("""
          Could not determine admin console location from server name.""")


    else:
      self.redirect('%s%s%s' % (APPENGINE_URL, CONSOLE_SUFFIX, app_id))
Extra method for cleaning linebreaks
dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/ext/admin_redirect/main.py/RedirectToAdminConsole.get--crossover with--dataset/ETHPy150Open evennia/evennia/evennia/utils/text2html.py/TextToHTMLparser.convert_linebreaks