Detaches a disk from a virtual machine.

    .. versionadded:: 2016.3.0

    name
        The name of the VM from which to detach the network interface.

    nic_id
        The ID of the nic to detach.

    CLI Example:

    .. code-block:: bash

        salt-cloud -a vm_detach_nic my-vm nic_id=1

def vm_detach_nic(name, kwargs=None, call=None):
    '''
    Detaches a disk from a virtual machine.

    .. versionadded:: 2016.3.0

    name
        The name of the VM from which to detach the network interface.

    nic_id
        The ID of the nic to detach.

    CLI Example:

    .. code-block:: bash

        salt-cloud -a vm_detach_nic my-vm nic_id=1
    '''
    if call != 'action':
        raise SaltCloudSystemExit(
            'The vm_detach_nic action must be called with -a or --action.'
        )

    if kwargs is None:
        kwargs = {}

    nic_id = kwargs.get('nic_id', None)
    if nic_id is None:
        raise SaltCloudSystemExit(
            'The vm_detach_nic function requires a \'nic_id\' to be provided.'
        )

    server, user, password = _get_xml_rpc()
    auth = ':'.join([user, password])
    vm_id = int(get_vm_id(kwargs={'name': name}))
    response = server.one.vm.detachnic(auth, vm_id, int(nic_id))

    data = {
        'action': 'vm.detachnic',
        'nic_detached': response[0],
        'vm_id': response[1],
        'error_code': response[2],
    }

    return data