'Return whether a block of interactive input can accept more input.
This method is meant to be used by line-oriented frontends, who need to
guess whether a block is complete or not based solely on prior and
current input lines.  The InputSplitter considers it has a complete
interactive block and will not accept more input when either:
* A SyntaxError is raised
* The code is complete and consists of a single line or a single
non-compound statement
* The code is complete and has a blank line at the end
If the current input produces a syntax error, this method immediately
returns False but does *not* raise the syntax error exception, as
typically clients will want to send invalid syntax to an execution
backend which might convert the invalid syntax into valid Python via
one of the dynamic IPython mechanisms.'

def push_accepts_more(self):

    if (not self._is_complete):
        return True
    last_line = self.source.splitlines()[(-1)]
    if ((not last_line) or last_line.isspace()):
        return False
    if (self.indent_spaces == 0):
        if (len(self.source.splitlines()) <= 1):
            return False
        try:
            code_ast = ast.parse(u''.join(self._buffer))
        except Exception:
            return False
        else:
            if ((len(code_ast.body) == 1) and (not hasattr(code_ast.body[0], 'body'))):
                return False
    return True
