.. versionadded:: 2015.8.0

    Cleans up all disks associated with the account, which are not attached.
    *** CAUTION *** This is a destructive function with no undo button, and no
    "Are you sure?" confirmation!

    CLI Examples:

    .. code-block:: bash

        salt-cloud -f cleanup_unattached_disks my-azure name=my_disk
        salt-cloud -f cleanup_unattached_disks my-azure name=my_disk delete_vhd=True

def cleanup_unattached_disks(kwargs=None, conn=None, call=None):
    '''
    .. versionadded:: 2015.8.0

    Cleans up all disks associated with the account, which are not attached.
    *** CAUTION *** This is a destructive function with no undo button, and no
    "Are you sure?" confirmation!

    CLI Examples:

    .. code-block:: bash

        salt-cloud -f cleanup_unattached_disks my-azure name=my_disk
        salt-cloud -f cleanup_unattached_disks my-azure name=my_disk delete_vhd=True
    '''
    if call != 'function':
        raise SaltCloudSystemExit(
            'The delete_disk function must be called with -f or --function.'
        )

    if kwargs is None:
        kwargs = {}

    disks = list_disks(kwargs=kwargs, conn=conn, call='function')
    for disk in disks:
        if disks[disk]['attached_to'] is None:
            del_kwargs = {
                'name': disks[disk]['name'],
                'delete_vhd': kwargs.get('delete_vhd', False)
            }
            log.info(
                'Deleting disk %s, deleting VHD: %s',
                del_kwargs['name'], del_kwargs['delete_vhd']
            )
            data = delete_disk(kwargs=del_kwargs, call='function')
    return True