def validate_string(s):
 try:
  return (len(s) > 0)
 except TypeError:
  return False

def validate_string ( s ) : try : return ( len ( s ) > 0 ) except TypeError : return False
validates that value is an instance of basestring for python 2 or str for python 3 .