Seems like the check is incomplete, do you want to compare res.code with something? If it's not the case just "if not res" should be sufficient.