def delete_device(name, safety_on=True):
    '''
    Deletes a device from Vistara based on DNS name or partial name. By default,
    delete_device will only perform the delete if a single host is returned. Set
    safety_on=False to delete all matches (up to default API search page size)

    CLI Example:

    .. code-block:: bash

        salt-run vistara.delete_device 'hostname-101.mycompany.com'
        salt-run vistara.delete_device 'hostname-101'
        salt-run vistara.delete_device 'hostname-1' safety_on=False

    '''

    config = _get_vistara_configuration()
    if not config:
        return False

    access_token = _get_oath2_access_token(config['client_key'], config['client_secret'])

    if not access_token:
        return 'Vistara access token not available'

    query_string = 'dnsName:{0}'.format(name)

    devices = _search_devices(query_string, config['client_id'], access_token)

    if not devices:
        return "No devices found"

    device_count = len(devices)

    if safety_on and device_count != 1:
        return "Expected to delete 1 device and found {0}. "\
            "Set safety_on=False to override.".format(device_count)

    delete_responses = []
    for device in devices:
        device_id = device['id']
        log.debug(device_id)
        delete_response = _delete_resource(device_id, config['client_id'], access_token)
        if not delete_response:
            return False
        delete_responses.append(delete_response)

    return delete_responses
Deletes a device from Vistara based on DNS name or partial name. By default,
    delete_device will only perform the delete if a single host is returned. Set
    safety_on=False to delete all matches (up to default API search page size)

    CLI Example:

    .. code-block:: bash

        salt-run vistara.delete_device 'hostname-101.mycompany.com'
        salt-run vistara.delete_device 'hostname-101'
        salt-run vistara.delete_device 'hostname-1' safety_on=False