def METHOD_NAME(self, document, complete_event):
    if not document.current_line.strip():
        return
    # Some bits of our completion system may print stuff (e.g. if a module
    # is imported). This context manager ensures that doesn't interfere with
    # the prompt.
    with patch_stdout(), provisionalcompleter():
        body = document.text
        cursor_row = document.cursor_position_row
        cursor_col = document.cursor_position_col
        cursor_position = document.cursor_position
        offset = cursor_to_position(body, cursor_row, cursor_col)
        try:
            yield from self._get_completions(body, offset, cursor_position, self.ipy_completer)
        except Exception as e:
            try:
                exc_type, exc_value, exc_tb = sys.exc_info()
                traceback.print_exception(exc_type, exc_value, exc_tb)
            except AttributeError:
                print('Unrecoverable Error in completions')