@memoize_default()
    def _get_under_cursor_stmt(self, cursor_txt, start_pos=None):
        tokenizer = source_tokens(cursor_txt)
        r = Parser(self._grammar, cursor_txt, tokenizer=tokenizer)
        try:
            # Take the last statement available that is not an endmarker.
            # And because it's a simple_stmt, we need to get the first child.
            stmt = r.module.children[-2].children[0]
        except (__HOLE__, IndexError):
            return None

        user_stmt = self._parser.user_stmt()
        if user_stmt is None:
            # Set the start_pos to a pseudo position, that doesn't exist but
            # works perfectly well (for both completions in docstrings and
            # statements).
            pos = start_pos or self._pos
        else:
            pos = user_stmt.start_pos

        stmt.move(pos[0] - 1, pos[1])  # Moving the offset.
        stmt.parent = self._parser.user_scope()
        return stmt
dataset/ETHPy150Open davidhalter/jedi/jedi/api/__init__.py/Script._get_under_cursor_stmt