code: def _capture_valid_app_component_name(
      value: Optional[str] = None, resource_type: str = "app"
  ) -> str:
      prompt = f"""
      ⚡ Creating Lightning {resource_type} ⚡
      """
      logger.info(prompt)
  
      try:
          if value is None:
              value = input(
                  f"\nName your Lightning {resource_type} (example: the-{resource_type}-name) >  "
              )
          value = value.strip().lower()
          unsafe_chars = set(re.findall(r"[^a-z0-9\-]", value))
          if len(unsafe_chars) > 0:
              m = f"""
              Error: your Lightning {resource_type} name:
              {value}
  
              contains the following unsupported characters:
              {unsafe_chars}
  
              A Lightning {resource_type} name can only contain letters (a-z) numbers (0-9) and the '-' character
  
              valid example:
              lightning-{resource_type}
              """
              raise SystemExit(m)
  
      except KeyboardInterrupt:
          raise SystemExit(
              f"""
          ⚡ {resource_type} init aborted! ⚡
          """
          )
  
      return value
  
file_path: pytorch-lightning/src/lightning/app/cli/cmd_init.py
imports: import os
  import re
  import shutil
  from typing import List, Optional, Tuple
  from lightning.app.utilities.app_helpers import Logger
label_desc: Use image node_id 4 for calling a global function with example usage: _capture_valid_app_component_name(value, resource_type) and returns: value