Return the virt profiles for hypervisor.

    Currently there are profiles for:

    - nic
    - disk

    :param hypervisor: override the default machine type.
    :param connection: libvirt connection URI, overriding defaults

        .. versionadded:: 2019.2.0
    :param username: username to connect with, overriding defaults

        .. versionadded:: 2019.2.0
    :param password: password to connect with, overriding defaults

        .. versionadded:: 2019.2.0

    CLI Example:

    .. code-block:: bash

        salt '*' virt.get_profiles
        salt '*' virt.get_profiles hypervisor=esxi

def get_profiles(hypervisor=None, **kwargs):
    '''
    Return the virt profiles for hypervisor.

    Currently there are profiles for:

    - nic
    - disk

    :param hypervisor: override the default machine type.
    :param connection: libvirt connection URI, overriding defaults

        .. versionadded:: 2019.2.0
    :param username: username to connect with, overriding defaults

        .. versionadded:: 2019.2.0
    :param password: password to connect with, overriding defaults

        .. versionadded:: 2019.2.0

    CLI Example:

    .. code-block:: bash

        salt '*' virt.get_profiles
        salt '*' virt.get_profiles hypervisor=esxi
    '''
    ret = {}

    caps = capabilities(**kwargs)
    hypervisors = sorted({x for y in [guest['arch']['domains'].keys() for guest in caps['guests']] for x in y})
    default_hypervisor = 'kvm' if 'kvm' in hypervisors else hypervisors[0]

    if not hypervisor:
        hypervisor = __salt__['config.get']('libvirt:hypervisor')
        if hypervisor is not None:
            salt.utils.versions.warn_until(
                'Sodium',
                '\'libvirt:hypervisor\' configuration property has been deprecated. '
                'Rather use the \'virt:connection:uri\' to properly define the libvirt '
                'URI or alias of the host to connect to. \'libvirt:hypervisor\' will '
                'stop being used in {version}.'
            )
        else:
            # Use the machine types as possible values
            # Prefer 'kvm' over the others if available
            hypervisor = default_hypervisor
    virtconf = __salt__['config.get']('virt', {})
    for typ in ['disk', 'nic']:
        _func = getattr(sys.modules[__name__], '_{0}_profile'.format(typ))
        ret[typ] = {'default': _func('default', hypervisor)}
        if typ in virtconf:
            ret.setdefault(typ, {})
            for prf in virtconf[typ]:
                ret[typ][prf] = _func(prf, hypervisor)
    return ret