Return the host and domain capabilities in a single call.

    .. versionadded:: Neon

    :param connection: libvirt connection URI, overriding defaults
    :param username: username to connect with, overriding defaults
    :param password: password to connect with, overriding defaults

    CLI Example:

    .. code-block:: bash

        salt '*' virt.all_capabilities

def all_capabilities(**kwargs):
    '''
    Return the host and domain capabilities in a single call.

    .. versionadded:: Neon

    :param connection: libvirt connection URI, overriding defaults
    :param username: username to connect with, overriding defaults
    :param password: password to connect with, overriding defaults

    CLI Example:

    .. code-block:: bash

        salt '*' virt.all_capabilities

    '''
    conn = __get_conn(**kwargs)
    result = {}
    try:
        host_caps = ElementTree.fromstring(conn.getCapabilities())
        domains = [[(guest.get('arch', {}).get('name', None), key)
                    for key in guest.get('arch', {}).get('domains', {}).keys()]
                   for guest in [_parse_caps_guest(guest) for guest in host_caps.findall('guest')]]
        flattened = [pair for item in (x for x in domains) for pair in item]
        result = {
                'host': {
                    'host': _parse_caps_host(host_caps.find('host')),
                    'guests': [_parse_caps_guest(guest) for guest in host_caps.findall('guest')]
                },
                'domains': [_parse_domain_caps(ElementTree.fromstring(
                                conn.getDomainCapabilities(None, arch, None, domain)))
                            for (arch, domain) in flattened]}
    finally:
        conn.close()

    return result