Pythonically check if a variable name is valid
<p>tldr; see the final line; the rest is just preamble.  </p>

<hr>

<p>I am developing a test harness, which parses user scripts and generates a Python script which it then runs. The idea is for non-techie folks to be able to write high-level test scripts.</p>

<p>I have introduced the idea of variables, so a user can use the <code>LET</code> keyword in his script. E.g. <code>LET X = 42</code>, which I simply expand to <code>X = 42</code>. They can then use X later in their scripts - <code>RELEASE CONNECTION X</code></p>

<p>But what if someone writes <code>LET 2 = 3</code>? That's going to generate invalid Python. </p>

<p>If I have that <code>X</code> in a variable <code>variableName</code>, then how can I check whether <code>variableName</code> is a valid Python variable?</p>