def _validate_int(name, value, limits=(), strip='%'):
    '''
    Validate the named integer within the supplied limits inclusive and
    strip supplied unit characters
    '''
    comment = ''
    # Must be integral
    try:
        if isinstance(value, string_types):
            value = value.strip(' ' + strip)
        value = int(value)
    except (TypeError, ValueError):
        comment += '{0} must be an integer '.format(name)
    # Must be in range
    else:
        if len(limits) == 2:
            if value < limits[0] or value > limits[1]:
                comment += '{0} must be in the range [{1[0]}, {1[1]}] '.format(name, limits)
    return value, comment
Validate the named integer within the supplied limits inclusive and
    strip supplied unit characters