def validate_int_or_basestring(option, value):
 if isinstance(value, integer_types):
  return value
 elif isinstance(value, string_type):
  if value.isdigit():
   return int(value)
  return value
 raise TypeError(('Wrong type for %s, value must be an integer or a string' % (option,)))

def validate_int_or_basestring ( option , value ) : if isinstance ( value , integer_types ) : return value elif isinstance ( value , string_type ) : if value . isdigit ( ) : return int ( value ) return value raise TypeError ( ( 'Wrong type for %s, value must be an integer or a string' % ( option , ) ) )
validates that value is an integer or string .