Get a dict of data on a task.

    name
        Name of the task to get information about.

    CLI Example:

    .. code-block:: bash

        salt '*' kapacitor.get_task cpu

def get_task(name):
    '''
    Get a dict of data on a task.

    name
        Name of the task to get information about.

    CLI Example:

    .. code-block:: bash

        salt '*' kapacitor.get_task cpu
    '''
    url = _get_url()

    if version() < '0.13':
        task_url = '{0}/task?name={1}'.format(url, name)
    else:
        task_url = '{0}/kapacitor/v1/tasks/{1}?skip-format=true'.format(url, name)

    response = salt.utils.http.query(task_url, status=True)

    if response['status'] == 404:
        return None

    data = salt.utils.json.loads(response['body'])

    if version() < '0.13':
        return {
            'script': data['TICKscript'],
            'type': data['Type'],
            'dbrps': data['DBRPs'],
            'enabled': data['Enabled'],
        }

    return {
        'script': data['script'],
        'type': data['type'],
        'dbrps': data['dbrps'],
        'enabled': data['status'] == 'enabled',
    }