'Delete a CWE rule.
This  deletes them, but they will still show up in the AWS console.
Annoying.'

def delete_rule(self, rule_name):

    logger.debug('Deleting    existing    rule    {}'.format(rule_name))
    try:
        targets = self.events_client.list_targets_by_rule(Rule=rule_name)
    except botocore.exceptions.ClientError as e:
        error_code = e.response['Error']['Code']
        if (error_code == 'AccessDeniedException'):
            raise
        else:
            logger.debug('No    target    found    for    this    rule:    {}    {}'.format(rule_name, e.args[0]))
            return
    if (('Targets' in targets) and targets['Targets']):
        self.events_client.remove_targets(Rule=rule_name, Ids=[x['Id'] for x in targets['Targets']])
    else:
        logger.debug('No    target    to    delete')
    self.events_client.delete_rule(Name=rule_name)
