title: Python - check syntax of function code in string
body: <p>I am looking for code to check if a string representing a function header of a function is syntactically correct.</p>
  
  <p>Here is my string example:</p>
  
  <pre><code>'''+'def __init__(self,{arg})'.format(arg = ','.join(i for i in someListOranArgPassedIn), )+''':
  </code></pre>
  
  <p>If this function was defined as</p>
  
  <pre><code>def __init__(self,,...a,,//b):
  </code></pre>
  
  <p>and goes against syntactic rules, what can I add to raise an exception? </p>