'return True if source is parseable, heuristically
deindenting it by default.'

def isparseable(self, deindent=True):

    try:
        import parser
    except ImportError:
        def syntax_checker(x):
            return compile(x, 'asd', 'exec')
    else:
        syntax_checker = parser.suite
    if deindent:
        source = str(self.deindent())
    else:
        source = str(self)
    try:
        syntax_checker((source + '\n'))
    except KeyboardInterrupt:
        raise
    except Exception:
        return False
    else:
        return True
