def isident(s):
 first = (string.uppercase + '_')
 body = (string.digits + first)
 if (not s):
  return False
 if (s[0] not in first):
  return False
 if (not all(((c in body) for c in s[1:]))):
  return False
 return True

def isident ( s ) : first = ( string . uppercase + '_' ) body = ( string . digits + first ) if ( not s ) : return False if ( s [ 0 ] not in first ) : return False if ( not all ( ( ( c in body ) for c in s [ 1 : ] ) ) ) : return False return True
helper function to check whether a string is a valid identifier .