def handle_set_services(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 != '<STR_LIT>' or not account or account[<NUM_LIT:0>] == '<STR_LIT:.>':<EOL><INDENT>return HTTPBadRequest(request=req)<EOL><DEDENT>try:<EOL><INDENT>new_services = json.loads(req.body)<EOL><DEDENT>except ValueError as err:<EOL><INDENT>return HTTPBadRequest(body=str(err))<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>:<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>services = json.loads(resp.body)<EOL>for new_service, value in new_services.iteritems():<EOL><INDENT>if new_service in services:<EOL><INDENT>services[new_service].update(value)<EOL><DEDENT>else:<EOL><INDENT>services[new_service] = value<EOL><DEDENT><DEDENT>services = json.dumps(services)<EOL>resp = self.make_pre_authed_request(<EOL>req.environ, '<STR_LIT>', path, services).get_response(self.app)<EOL>if resp.status_int // <NUM_LIT:100> != <NUM_LIT:2>:<EOL><INDENT>raise Exception('<STR_LIT>' %<EOL>(path, resp.status))<EOL><DEDENT>return Response(request=req, body=services,<EOL>content_type=CONTENT_TYPE_JSON)<EOL>
Handles the POST v2/<account>/.services call for setting services
        information. Can only be called by a reseller .admin.

        In the :func:`handle_get_account` (GET v2/<account>) call, a section of
        the returned JSON dict is `services`. This section looks something like
        this::

              "services": {"storage": {"default": "local",
                            "local": "http://127.0.0.1:8080/v1/AUTH_018c3946"}}

        Making use of this section is described in :func:`handle_get_token`.

        This function allows setting values within this section for the
        <account>, allowing the addition of new service end points or updating
        existing ones.

        The body of the POST request should contain a JSON dict with the
        following format::

            {"service_name": {"end_point_name": "end_point_value"}}

        There can be multiple services and multiple end points in the same
        call.

        Any new services or end points will be added to the existing set of
        services and end points. Any existing services with the same service
        name will be merged with the new end points. Any existing end points
        with the same end point name will have their values updated.

        The updated services dictionary will be returned on success.

        :param req: The swob.Request to process.
        :returns: swob.Response, 2xx on success with the udpated services JSON
                  dict as described above