def _validate_int(name, value, limits=(), strip='%'):
 comment = ''
 try:
  if isinstance(value, string_types):
   value = value.strip((' ' + strip))
  value = int(value)
 except (TypeError, ValueError):
  comment += '{0} must be an integer '.format(name)
 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)

def _validate_int ( name , value , limits = ( ) , strip = '%' ) : comment = '' try : if isinstance ( value , string_types ) : value = value . strip ( ( ' ' + strip ) ) value = int ( value ) except ( TypeError , ValueError ) : comment += '{0} must be an integer ' . format ( name ) 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 .