Get db connection and cursor to work with python "with"