def parseresponse(self, resp):
        """Parse an API response."""
        
        if self.RESPONSE_TOKEN not in resp:
            raise BustimeError("The Bustime API returned an invalid response: {}".format(resp))
        elif self.ERROR_TOKEN in resp:
            return self.errorhandle(resp)
        else:
            if self.format == 'json':
                return xmltodict.parse(resp)[self.RESPONSE_TOKEN]
            elif self.format == 'xml':
                return resp
dataset/ETHPy150Open nhfruchter/pgh-bustime/pghbustime/interface.py/BustimeAPI.parseresponse/original