def set_sandbox_mode(self, enabled):
    if enabled:
        if ('test' in self.urls):
            self.urls['api_backup'] = self.urls['api']
            self.urls['api'] = self.urls['test']
        else:
            raise NotSupported((self.id + ' does not have a sandbox URL'))
    elif ('api_backup' in self.urls):
        self.urls['api'] = self.urls['api_backup']
        del self.urls['api_backup']
def set_sandbox_mode(self, enabled):
    if enabled:
        if ('test' in self.urls):
            self.urls['api_backup'] = self.urls['api']
            self.urls['api'] = self.urls['test']
        else:
            raise NotSupported((self.id + ' does not have a sandbox URL'))
    elif ('api_backup' in self.urls):
        self.urls['api'] = self.urls['api_backup']
        del self.urls['api_backup']