As per the documentation, an identifer can be defined as - identifier ::= (letter|"_") (letter | digit | "_")*
So the regular expression is - ^[^\d\W]\w*\Z. You can refer the following code to understand a bit more.
import re
identifier = re.compile(r"^[^\d\W]\w*\Z", re.UNICODE)
tests = [ "c", "b11", "_z1", "1q", "da$%@%", "xx yy", "pp_ww", "vv\n" ]
for test in tests:
result = re.match(identifier, test)
print("%r\t= %s" % (test, (result is not None)))
The output will be like
'c' = True
'b11' = True
'_z1' = True
'1q' = False
'da$%@%' = False
'xx yy' = False
'pp_ww' = True
'vv\n' = False