def handle_delete_account(self, req):
if not self.is_reseller_admin(req):<EOL><INDENT>return self.denied_response(req)<EOL><DEDENT>account = req.path_info_pop()<EOL>if req.path_info or not account or account[<NUM_LIT:0>] == '<STR_LIT:.>':<EOL><INDENT>return HTTPBadRequest(request=req)<EOL><DEDENT>marker = '<STR_LIT>'<EOL>while True:<EOL><INDENT>path = '<STR_LIT>' % (quote('<STR_LIT>' %<EOL>(self.auth_account, account)), quote(marker))<EOL>resp = self.make_pre_authed_request(<EOL>req.environ, '<STR_LIT:GET>', path).get_response(self.app)<EOL>if resp.status_int == <NUM_LIT>:<EOL><INDENT>return HTTPNotFound(request=req)<EOL><DEDENT>if resp.status_int // <NUM_LIT:100> != <NUM_LIT:2>:<EOL><INDENT>raise Exception('<STR_LIT>' %<EOL>(path, resp.status))<EOL><DEDENT>account_id = resp.headers['<STR_LIT>']<EOL>sublisting = json.loads(resp.body)<EOL>if not sublisting:<EOL><INDENT>break<EOL><DEDENT>for obj in sublisting:<EOL><INDENT>if obj['<STR_LIT:name>'][<NUM_LIT:0>] != '<STR_LIT:.>':<EOL><INDENT>return HTTPConflict(request=req)<EOL><DEDENT><DEDENT>marker = sublisting[-<NUM_LIT:1>]['<STR_LIT:name>'].encode('<STR_LIT:utf-8>')<EOL><DEDENT>path = quote('<STR_LIT>' % (self.auth_account, account))<EOL>resp = self.make_pre_authed_request(<EOL>req.environ, '<STR_LIT:GET>', path).get_response(self.app)<EOL>if resp.status_int // <NUM_LIT:100> != <NUM_LIT:2> and resp.status_int != <NUM_LIT>:<EOL><INDENT>raise Exception('<STR_LIT>' %<EOL>(path, resp.status))<EOL><DEDENT>if resp.status_int // <NUM_LIT:100> == <NUM_LIT:2>:<EOL><INDENT>services = json.loads(resp.body)<EOL>deleted_any = False<EOL>for name, url in services['<STR_LIT>'].iteritems():<EOL><INDENT>if name != '<STR_LIT:default>':<EOL><INDENT>parsed = urlparse(url)<EOL>conn = self.get_conn(parsed)<EOL>conn.request('<STR_LIT>', parsed.path,<EOL>headers={'<STR_LIT>': self.get_itoken(req.environ)})<EOL>resp = conn.getresponse()<EOL>resp.read()<EOL>if resp.status == <NUM_LIT>:<EOL><INDENT>if deleted_any:<EOL><INDENT>raise Exception('<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>' % (url, resp.status, resp.reason))<EOL><DEDENT>else:<EOL><INDENT>return HTTPConflict(request=req)<EOL><DEDENT><DEDENT>if resp.status // <NUM_LIT:100> != <NUM_LIT:2> and resp.status != <NUM_LIT>:<EOL><INDENT>raise Exception('<STR_LIT>'<EOL>'<STR_LIT>' %<EOL>(url, resp.status, resp.reason))<EOL><DEDENT>deleted_any = True<EOL><DEDENT><DEDENT>path = quote('<STR_LIT>' %<EOL>(self.auth_account, account))<EOL>resp = self.make_pre_authed_request(<EOL>req.environ, '<STR_LIT>', path).get_response(self.app)<EOL>if resp.status_int // <NUM_LIT:100> != <NUM_LIT:2> and resp.status_int != <NUM_LIT>:<EOL><INDENT>raise Exception('<STR_LIT>' %<EOL>(path, resp.status))<EOL><DEDENT><DEDENT>path = quote('<STR_LIT>' %<EOL>(self.auth_account, account_id))<EOL>resp = self.make_pre_authed_request(<EOL>req.environ, '<STR_LIT>', path).get_response(self.app)<EOL>if resp.status_int // <NUM_LIT:100> != <NUM_LIT:2> and resp.status_int != <NUM_LIT>:<EOL><INDENT>raise Exception('<STR_LIT>' %<EOL>(path, resp.status))<EOL><DEDENT>path = quote('<STR_LIT>' % (self.auth_account, account))<EOL>resp = self.make_pre_authed_request(<EOL>req.environ, '<STR_LIT>', path).get_response(self.app)<EOL>if resp.status_int // <NUM_LIT:100> != <NUM_LIT:2> and resp.status_int != <NUM_LIT>:<EOL><INDENT>raise Exception('<STR_LIT>' %<EOL>(path, resp.status))<EOL><DEDENT>return HTTPNoContent(request=req)<EOL>
Handles the DELETE v2/<account> call for removing an account from the
        auth system. Can only be called by a .reseller_admin.

        :param req: The swob.Request to process.
        :returns: swob.Response, 2xx on success.