'This function is responsible for validating destination.
@type return_bool: bool
@param return_bool: True when we are only interested in the result of the
validation, and not the validated rule itself.
@type valid_rule: bool
@param valid_rule: returns True if everything is valid. False if it encounters any
abnormalities in the config.
@type original_rule: dict
@param original_rule: contains the original received rule
@type counter: int
@param counter: this counter is used to identify what rule # is currently being
validated. Necessary for log output.
@type tool: str
@param tool: the name of the current tool. Necessary for log output.
@rtype: bool, dict (tuple)
@return: validated rule and result of validation'

@classmethod
def __validate_destination(cls, valid_rule, return_bool, rule, tool, counter):

    if ('fail_message' in rule):
        if (('destination' not in rule) or (rule['destination'] != 'fail')):
            error = ('Found    a    fail_message    for    rule    ' + str(counter))
            error += (("    in    '" + str(tool)) + "',    but    destination    is    not    'fail'!")
            if (not return_bool):
                error += "    Setting    destination    to    'fail'."
            if verbose:
                log.debug(error)
            valid_rule = False
        rule['destination'] = 'fail'
    if ('destination' in rule):
        if isinstance(rule['destination'], str):
            if ((rule['destination'] == 'fail') and ('fail_message' not in rule)):
                error = ('Missing    a    fail_message    for    rule    ' + str(counter))
                error += (("    in    '" + str(tool)) + "'.")
                if (not return_bool):
                    error += '    Adding    generic    fail_message.'
                    message = ('Invalid    parameters    for    rule    ' + str(counter))
                    message += (("    in    '" + str(tool)) + "'.")
                    rule['fail_message'] = message
                if verbose:
                    log.debug(error)
                valid_rule = False
        elif isinstance(rule['destination'], dict):
            if (('priority' in rule['destination']) and isinstance(rule['destination']['priority'], dict)):
                if ('med' not in rule['destination']['priority']):
                    error = ("No    'med'    priority    destination    for    rule    " + str(counter))
                    error += (("    in    '" + str(tool)) + "'.")
                    if (not return_bool):
                        error += '    Ignoring...'
                    if verbose:
                        log.debug(error)
                    valid_rule = False
                else:
                    for priority in rule['destination']['priority']:
                        if (priority not in ['low', 'med', 'high']):
                            error = ("Invalid    priority    destination    '" + str(priority))
                            error += ("'    for    rule    " + str(counter))
                            error += (("    in    '" + str(tool)) + "'.")
                            if (not return_bool):
                                error += '    Ignoring...'
                            if verbose:
                                log.debug(error)
                            valid_rule = False
                        elif (not isinstance(rule['destination']['priority'][priority], str)):
                            error = ("No    '" + str(priority))
                            error += ("'priority    destination    for    rule    " + str(counter))
                            error += (("    in    '" + str(tool)) + "'.")
                            if (not return_bool):
                                error += '    Ignoring...'
                            if verbose:
                                log.debug(error)
                            valid_rule = False
            else:
                error = ('No    destination    specified    for    rule    ' + str(counter))
                error += (("    in    '" + str(tool)) + "'.")
                if (not return_bool):
                    error += '    Ignoring...'
                if verbose:
                    log.debug(error)
                valid_rule = False
        else:
            error = ('No    destination    specified    for    rule    ' + str(counter))
            error += (("    in    '" + str(tool)) + "'.")
            if (not return_bool):
                error += '    Ignoring...'
            if verbose:
                log.debug(error)
            valid_rule = False
    else:
        error = ('No    destination    specified    for    rule    ' + str(counter))
        error += (("    in    '" + str(tool)) + "'.")
        if (not return_bool):
            error += '    Ignoring...'
        if verbose:
            log.debug(error)
        valid_rule = False
    return (valid_rule, rule)
