def _normalize_deviation_args(lower, upper, msg):
    """Normalize deviation acceptance arguments to support both
    "tolerance" and "lower, upper" signatures. This helper function
    is intended for internal use.
    """
    if isinstance(upper, str) and msg is None:
        upper, msg = None, msg
    if upper == None:
        tolerance = lower
        if tolerance != abs(tolerance):
            raise ValueError(
                'tolerance should not be negative, for full control of lower and upper bounds, use "lower, upper" syntax'
                )
        lower, upper = -tolerance, tolerance
    if lower > upper:
        raise ValueError(
            'lower must not be greater than upper, got {0} (lower) and {1} (upper)'
            .format(lower, upper))
    return lower, upper, msg
