code: def _parse_hosts_contents(self, hosts_contents):
          
          sections = []
          cur_section = {
              'type': 'hosts',
              'name': None,
              'entries': []
          }
  
          for line in hosts_contents:
              line = line.strip()
              if line.startswith('#') or not line:
                  continue
              elif line.startswith('['):
                  sections.append(cur_section)
                  section_type, name = self._parse_line_section(line)
                  cur_section = {
                      'type': section_type,
                      'name': name,
                      'entries': []
                  }
              else:
                  name, vars = self._parse_line_entry(line, cur_section['type'])
                  entry = {
                      'name': name,
                      'hostvars': vars
                  }
                  cur_section['entries'].append(entry)
          sections.append(cur_section)
          return sections
docs: Parse the inventory contents. This returns a list of sections found in
          the inventory, which can then be used to figure out which hosts belong
          to which groups and such. Each section has a name, a type ('hosts',
          'children', 'vars') and a list of entries for that section. Entries
          consist of a hostname and the variables. For 'vars' sections, the
          hostname is None.
  
          For example:
              [production:children]
              frontend  purpose="web"
              db        purpose="db"
          Returns:
              {
                  'name': 'production',
                  'type': 'children',
                  'entries': [
                      {'name': 'frontend', 'hostvars': {'purpose': 'web'}},
                      {'name': 'db', 'hostvars': {'purpose': 'db'}},
                  ]
              }