code: def app_name_from_ini_parser(ini_parser):
      
      app_names = [sect.split(':')[-1]
                   for sect in ini_parser.sections()
                   if sect[:4] == 'app:']
      if len(app_names) == 1:
          app_name = app_names[0]
      else:
          pp_sect_name = 'pipeline:main'
          if ini_parser.has_section(pp_sect_name):
              pipeline_apps = ini_parser.get(pp_sect_name, 'pipeline').split()
              app_name = pipeline_apps[-1]
          else:
              raise ValueError('Could not determine application name. '
                               'You need to either define exactly one '
                               'app:<app name> section or a '
                               'pipeline:main section in your ini '
                               'file.')
      return app_name
docs: Returns the name of the main application from the given ini file parser.
      The name is found as follows:
       * If the ini file contains only one app:<app name> section,
         return this app name;
       * Else, if the ini file contains a pipeline:main section, use
         the name of the innermost app;
       * Else raise ValueError.
  
      :param ini_parser: :class:`configparser.SafeConfigParser` instance with
          an ini file read.