### Summary

When I try to run

`ansible-inventory --list --toml -vvv`

It fails with this exception:

```
ansible-inventory 2.10.7
  config file = /home/user/ansible/ansible.cfg
  configured module search path = ['/home/user/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/user/.local/lib/python3.6/site-packages/ansible
  executable location = /home/user/.local/bin/ansible-inventory
  python version = 3.6.9 (default, Jan 26 2021, 15:33:00) [GCC 8.4.0]
Using /home/user/ansible/ansible.cfg as config file
host_list declined parsing /home/user/ansible/inventory/hosts as it did not pass its verify_file() method
script declined parsing /home/user/ansible/inventory/hosts as it did not pass its verify_file() method
auto declined parsing /home/user/ansible/inventory/hosts as it did not pass its verify_file() method
Parsed /home/user/ansible/inventory/hosts inventory source with ini plugin
ERROR! Unexpected Exception, this is probably a bug: '7.2'
the full traceback was:

Traceback (most recent call last):
  File "/home/user/.local/bin/ansible-inventory", line 123, in <module>
    exit_code = cli.run()
  File "/home/user/.local/lib/python3.6/site-packages/ansible/cli/inventory.py", line 151, in run
    results = self.dump(results)
  File "/home/user/.local/lib/python3.6/site-packages/ansible/cli/inventory.py", line 181, in dump
    results = toml_dumps(stuff)
  File "/home/user/.local/lib/python3.6/site-packages/toml/encoder.py", line 72, in dumps
    sections[section], section)
  File "/home/user/.local/lib/python3.6/site-packages/toml/encoder.py", line 193, in dump_sections
    if not isinstance(o[section], dict):
KeyError: '7.2'
```

`ansible-inventory --list` without `--toml` works fine. Inventory file has ini format.


### Issue Type

Bug Report

### Component Name

ansible-inventory

### Ansible Version

```console
ansible 2.10.7
  config file = /home/user/ansible/ansible.cfg
  configured module search path = ['/home/user/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/user/.local/lib/python3.6/site-packages/ansible
  executable location = /home/user/.local/bin/ansible
  python version = 3.6.9 (default, Jan 26 2021, 15:33:00) [GCC 8.4.0]
```


### Configuration

```console
ANSIBLE_NOCOWS(/home/user/ansible/ansible.cfg) = True
ANSIBLE_PIPELINING(/home/user/ansible/ansible.cfg) = True
ANSIBLE_SSH_CONTROL_PATH(/home/user/ansible/ansible.cfg) = /tmp/ansible-ssh-%%h-%%p-%%r
ANSIBLE_SSH_RETRIES(/home/user/ansible/ansible.cfg) = 1
CACHE_PLUGIN(/home/user/ansible/ansible.cfg) = memory
DEFAULT_FORKS(/home/user/ansible/ansible.cfg) = 20
DEFAULT_GATHERING(/home/user/ansible/ansible.cfg) = implicit
DEFAULT_HOST_LIST(/home/user/ansible/ansible.cfg) = ['/home/user/ansible/inventory']
DEFAULT_JINJA2_EXTENSIONS(/home/user/ansible/ansible.cfg) = jinja2.ext.do,jinja2.ext.loopcontrols
DEFAULT_LOAD_CALLBACK_PLUGINS(/home/user/ansible/ansible.cfg) = True
DEFAULT_MANAGED_STR(/home/user/ansible/ansible.cfg) = Ansible managed: {file} modified by {uid} on {host}
DEFAULT_MODULE_NAME(/home/user/ansible/ansible.cfg) = shell
DEFAULT_POLL_INTERVAL(/home/user/ansible/ansible.cfg) = 15
DEFAULT_ROLES_PATH(/home/user/ansible/ansible.cfg) = ['/home/user/ansible/roles', '/home/user/ansible/roles-sha
DEFAULT_TIMEOUT(/home/user/ansible/ansible.cfg) = 10
DEFAULT_TRANSPORT(/home/user/ansible/ansible.cfg) = smart
DEFAULT_VAULT_PASSWORD_FILE(/home/user/ansible/ansible.cfg) = **********
DUPLICATE_YAML_DICT_KEY(/home/user/ansible/ansible.cfg) = False
RETRY_FILES_ENABLED(/home/user/ansible/ansible.cfg) = False
```


### OS / Environment

Ubuntu 18.04
Python 3.6.9


### Steps to Reproduce

<!--- Paste example playbooks or commands between quotes below -->
```
ansible-inventory --list --toml -vvv
```


### Expected Results

Inventory in toml format.

### Actual Results

```console
ERROR! Unexpected Exception, this is probably a bug: '7.2'
to see the full traceback, use -vvv
```


### Code of Conduct

- [X] I agree to follow the Ansible Code of Conduct
seen = set()
        def format_group(group):
            results = {}
            results[group.name] = {}
            if group.name != 'all':
                results[group.name]['hosts'] = [h.name for h in sorted(group.hosts, key=attrgetter('name'))]
            results[group.name]['children'] = []
            for subgroup in sorted(group.child_groups, key=attrgetter('name')):
                results[group.name]['children'].append(subgroup.name)
                if subgroup.name not in seen:
                    results.update(format_group(subgroup))
                    seen.add(subgroup.name)
            if context.CLIARGS['export']:
                results[group.name]['vars'] = self._get_group_variables(group)
            self._remove_empty(results[group.name])
            if not results[group.name]:
                del results[group.name]
            return results
        results = format_group(top)
        
        results['_meta'] = {'hostvars': {}}
        hosts = self.inventory.get_hosts()
        for host in hosts:
            hvars = self._get_host_variables(host)
            if hvars:
                results['_meta']['hostvars'][host.name] = hvars
        return results
    def yaml_inventory(self, top):