Cancel a downtime by id or by scope.

    CLI Example:

    .. code-block:: bash

        salt-call datadog.cancel_downtime scope='host:app01' \\
                                          api_key='0123456789' \\
                                          app_key='9876543210'`

    Arguments - Either scope or id is required.

    :param id:      The downtime ID
    :param scope:   The downtime scope

def cancel_downtime(api_key=None,
                    app_key=None,
                    scope=None,
                    id=None):
    '''
    Cancel a downtime by id or by scope.

    CLI Example:

    .. code-block:: bash

        salt-call datadog.cancel_downtime scope='host:app01' \\
                                          api_key='0123456789' \\
                                          app_key='9876543210'`

    Arguments - Either scope or id is required.

    :param id:      The downtime ID
    :param scope:   The downtime scope
    '''
    if api_key is None:
        raise SaltInvocationError('api_key must be specified')
    if app_key is None:
        raise SaltInvocationError('app_key must be specified')
    _initialize_connection(api_key, app_key)

    ret = {'result': False,
           'response': None,
           'comment': ''}
    if id:
        response = datadog.api.Downtime.delete(id)
        ret['response'] = response
        if not response:  # Then call has succeeded
            ret['result'] = True
            ret['comment'] = 'Successfully cancelled downtime'
        return ret
    elif scope:
        params = {
            'api_key': api_key,
            'application_key': app_key,
            'scope': scope
        }
        response = requests.post(
            'https://app.datadoghq.com/api/v1/downtime/cancel/by_scope',
            params=params
            )
        if response.status_code == 200:
            ret['result'] = True
            ret['response'] = response.json()
            ret['comment'] = 'Successfully cancelled downtime'
        else:
            ret['response'] = response.text
            ret['comment'] = 'Status Code: {}'.format(response.status_code)
        return ret
    else:
        raise SaltInvocationError('One of id or scope must be specified')

    return ret