def is_python(text, filename='<STR_LIT>'):
try:<EOL><INDENT>compile(text, filename, '<STR_LIT>')<EOL><DEDENT>except (SyntaxError, TypeError):<EOL><INDENT>return False<EOL><DEDENT>else:<EOL><INDENT>return True<EOL><DEDENT>
Is this string a valid Python script?