#NEWLINE# def validate_int_or_basestring( option , value ) : #NEWLINE# #INDENT# "Validates that 'value' is an integer or string.\n    " #NEWLINE# if isinstance ( value , integer_types ) : #NEWLINE# #INDENT# return value #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if isinstance ( value , string_type ) : #NEWLINE# #INDENT# if value . isdigit ( ) : #NEWLINE# #INDENT# return int ( value ) #NEWLINE# #UNINDENT# return value #NEWLINE# #UNINDENT# #UNINDENT# raise TypeError ( ( 'Wrong type for %s, value must be an integer or a string' % ( option , ) ) )