def get_range(value):
    """
    Find the max/min ranges for a Nagios range comparison.

    Nagios handles ranges by accepting them as strings. The curent rules
    according to the API assume [@]start:end and include:

    * If start is empty, start is 0.
    * If start is ~, start is -infinity.
    * Alert if value is <= start, or >= end.
    * If prepended with @, alert if value is between start and end.

    The fact 0 and : are optional make it somewhat confusing and counter-
    intuitive; most plugin authors don't know that <= 0 should trigger alerts.

    :param value: Nagios-compatible range string to parse.

    :return list: A single list with three elements representing the min and
        max boundaries for the range, and whether or not to invert the match.
    """
    raw = value

    # If we find a '@' at the beginning of the range, we should invert
    # the match.

    invert = False

    if value.find('@') == 0:
        invert = True
        value = value.lstrip('@')

    # The : separates a max/min range. If it exists, there is at least
    # a minimum. We'll start our ranges at zero and infinity so we don't
    # have to worry about complex testing logic.

    bottom = 0
    top = float('infinity')

    if value.find(':') > 0:
        (bottom, top) = value.split(':')
        if top == '':
            top = float('infinity')
        else:
            top = float(top)

        if bottom == '':
            bottom = 0
        elif bottom == '~':
            bottom = -float('infinity')
        else:
            bottom = float(bottom)
    else:
        top = float(value)

    return (bottom, top, invert, raw)