def _is_python(source):
    """Return whether a string contains valid Python code."""
    try:
        ast.parse(source)
        return True
    except SyntaxError:
        return False
Return whether a string contains valid Python code.
ipymd/lib/python.py