If you're looking to get 'single NS_ surrounded by white spaces', you can add the white space character class into your token string:
def t_UN1(t): #NS_
r'\s+NS\_\s+'
return t
Side note: for PLY questions, the ply-hack google group is a good place to ask PLY-related questions.