code: def validate():
      """Display error messages and exit if no lore environment can be found."""
      if not os.path.exists(os.path.join(ROOT, APP, "__init__.py")):
          message = ansi.error() + " Python module not found."
          if os.environ.get("LORE_APP") is None:
              message += (
                  ' $LORE_APP is not set. Should it be different than "%s"?'
                  % APP
              )
          else:
              message += (
                  ' $LORE_APP is set to "%s". Should it be different?'
                  % APP
              )
          sys.exit(message)
  
      if exists():
          return
  
      if len(sys.argv) > 1:
          command = sys.argv[1]
      else:
          command = "lore"
      sys.exit(
          ansi.error() + " %s is only available in lore "
          "app directories (missing %s)"
          % (ansi.bold(command), ansi.underline(VERSION_PATH))
      )
  
imports: from __future__ import absolute_import, print_function, unicode_literals
  import glob
  import locale
  import os
  import re
  import socket
  import subprocess
  import sys
  import platform
  from io import open
  import pkg_resources
  from lore import ansi
label_desc: Use image node_id 4 for calling a global function with example usage: validate() without return types