def METHOD_NAME(self, query: AnyStr, *args: Any, **kwargs: Any) -> Iterator[DBApiCursor]:
    curr: DBApiCursor = None
    db_args = args if args else kwargs if kwargs else None
    with self._conn.cursor() as curr:
        try:
            curr.execute(query, db_args)
            yield DBApiCursorImpl(curr)  # type: ignore
        except psycopg2.Error as outer:
            try:
                self._reset_connection()
            except psycopg2.Error:
                self.close_connection()
                self.open_connection()
            raise outer