def summoner_name_to_id(self, summoner_name):
        """Tries getting the id of a summoner from their name usign the riot api
        This requires self.riot_api_key to be configured using self.configure
        Returns none if an error was found"""

        if self.riot_api_key:
            try:
                source = urllib.request.urlopen("http://"+urllib.parse.quote(self.region.lower()) +
                                                ".api.pvp.net/api/lol/" +
                                                urllib.parse.quote(self.region.lower()) +
                                                "/v1.4/summoner/by-name/" +
                                                urllib.parse.quote(summoner_name) +
                                                "?api_key="+urllib.parse.quote(self.riot_api_key)).read().decode()
            except urllib.error.HTTPError as err:
                if err.code == 401: #Unauthorized
                        self.logger.warning("An api request has been attempted with an invalid riot api key.")
                        self.logger.debug("Removing the riot api key from the configuration.")
                        self.riot_api_key = None
                elif err.code == 404: #Not found
                    self.logger.debug("An api request has been attempted while the riot api seems to be down at the moment.")
                return None
            else:
                data = json.loads(source)
                if data in summoner_name.replace(" ", "").lower():
                    return str(data[summoner_name.replace(" ", "").lower()]["id"])
                else:
                    return None

        else:
            self.logger.warning("An api request has been attempted without an api key.")
dataset/ETHPy150Open Mathzx/zxLoLBoT/zxlolbot.py/zxLoLBoT.summoner_name_to_id/swapped operands of `in`