def Validate(value, type):
 if (not value):
  raise ValueError(('Value should not be empty; received %s.' % value))
 elif (not isinstance(value, type)):
  raise TypeError(('Expected a %s, but received %s (a %s).' % (type, value, value.__class__)))

def Validate ( value , type ) : if ( not value ) : raise ValueError ( ( 'Value should not be empty; received %s.' % value ) ) elif ( not isinstance ( value , type ) ) : raise TypeError ( ( 'Expected a %s, but received %s (a %s).' % ( type , value , value . __class__ ) ) )
checks that value is non-empty and of the right type .