def __evaluate_result(self, result, condition):
        """
        Evaluates a result of a heuristic
        with the condition given in the config.

        :param mixed result: The result of the heuristic
        :param mixed condition: The condition string to evaluate on the result
        :return bool: Whether the heuristic result matches the condition
        """

        # If result is bool this means, that the heuristic
        # is bool as well or has a special situation
        # (for example some condition [e.g. in config] is [not] met, thus
        #  just pass it)
        if isinstance(result, bool):
            return result

        # Check if the condition is a String condition,
        # allowing <=, >=, <, >, = conditions or string
        # when they start with " or '
        if isinstance(condition, basestring):

            # Check if result should match a string
            if (condition.startswith("'") and condition.endswith("'")) or \
                    (condition.startswith('"') and condition.endswith('"')):
                if isinstance(result, basestring):
                    self.log.debug("Condition %s recognized as string.",
                                   condition)
                    return result == condition[1:-1]
                return self.__evaluation_error(
                    result, condition, "Result not string")

            # Only number-comparision following
            if not isinstance(result, (float, int)):
                return self.__evaluation_error(
                    result, condition, "Result not number on comparision")

            # Check if result should match a number
            if condition.startswith("="):
                number = self.__try_parse_number(condition[1:])
                if isinstance(number, bool):
                    return self.__evaluation_error(
                        result, condition, "Number not parsable (=)")
                return result == number

            # Check if result should be >= then a number
            if condition.startswith(">="):
                number = self.__try_parse_number(condition[2:])
                if isinstance(number, bool):
                    return self.__evaluation_error(
                        result, condition, "Number not parsable (>=)")
                return result >= number

            # Check if result should be <= then a number
            if condition.startswith("<="):
                number = self.__try_parse_number(condition[2:])
                if isinstance(number, bool):
                    return self.__evaluation_error(
                        result, condition, "Number not parsable (<=)")
                return result <= number

            # Check if result should be > then a number
            if condition.startswith(">"):
                number = self.__try_parse_number(condition[1:])
                if isinstance(number, bool):
                    return self.__evaluation_error(
                        result, condition, "Number not parsable (>)")
                return result > number

            # Check if result should be < then a number
            if condition.startswith("<"):
                number = self.__try_parse_number(condition[1:])
                if isinstance(number, bool):
                    return self.__evaluation_error(
                        result, condition, "Number not parsable (<)")
                return result < number

            # Check if result should be equal a number
            number = self.__try_parse_number(condition)
            if isinstance(number, bool):
                return self.__evaluation_error(
                    result, condition, "Number not parsable")
            return result == number

        # Check if the condition is a number and matches the result
        if isinstance(condition, (float, int)) and isinstance(result, (float, int)):
            return condition == result

        return self.__evaluation_error(result, condition, "Unknown")
def __evaluate_result ( self , result , condition ) : if isinstance ( result , bool ) : return result if isinstance ( condition , basestring ) : if ( condition . startswith ( "'" ) and condition . endswith ( "'" ) ) or ( condition . startswith ( '"' ) and condition . endswith ( '"' ) ) : if isinstance ( result , basestring ) : self . log . debug ( "Condition %s recognized as string." , condition ) return result == condition [ 1 : - 1 ] return self . __evaluation_error ( result , condition , "Result not string" ) if not isinstance ( result , ( float , int ) ) : return self . __evaluation_error ( result , condition , "Result not number on comparision" ) if condition . startswith ( "=" ) : number = self . __try_parse_number ( condition [ 1 : ] ) if isinstance ( number , bool ) : return self . __evaluation_error ( result , condition , "Number not parsable (=)" ) return result == number if condition . startswith ( ">=" ) : number = self . __try_parse_number ( condition [ 2 : ] ) if isinstance ( number , bool ) : return self . __evaluation_error ( result , condition , "Number not parsable (>=)" ) return result >= number if condition . startswith ( "<=" ) : number = self . __try_parse_number ( condition [ 2 : ] ) if isinstance ( number , bool ) : return self . __evaluation_error ( result , condition , "Number not parsable (<=)" ) return result <= number if condition . startswith ( ">" ) : number = self . __try_parse_number ( condition [ 1 : ] ) if isinstance ( number , bool ) : return self . __evaluation_error ( result , condition , "Number not parsable (>)" ) return result > number if condition . startswith ( "<" ) : number = self . __try_parse_number ( condition [ 1 : ] ) if isinstance ( number , bool ) : return self . __evaluation_error ( result , condition , "Number not parsable (<)" ) return result < number number = self . __try_parse_number ( condition ) if isinstance ( number , bool ) : return self . __evaluation_error ( result , condition , "Number not parsable" ) return result == number if isinstance ( condition , ( float , int ) ) and isinstance ( result , ( float , int ) ) : return condition == result return self . __evaluation_error ( result , condition , "Unknown" )
Evaluates a result of a heuristic
        with the condition given in the config.

        :param mixed result: The result of the heuristic
        :param mixed condition: The condition string to evaluate on the result
        :return bool: Whether the heuristic result matches the condition