def check_threshold(value, warning=None, critical=None):
        """
        checks a value against warning and critical thresholds
        threshold syntax: https://nagios-plugins.org/doc/guidelines.html

        arguments:
            value: the value to check
            warning: warning threshold
            critical: critical threshold

        returns:
            the result status of the check
        """
        if critical is not None:
            if not isinstance(critical, Threshold):
                critical = Threshold(critical)
            if not critical.check(value):
                return CRITICAL
        if warning is not None:
            if not isinstance(warning, Threshold):
                warning = Threshold(warning)
            if not warning.check(value):
                return WARNING
        return OK