def set_session_persistence(self, loadbalancer, val):
        """
        Sets the session persistence for the given load balancer.
        """
        val = val.upper()
        uri = "/loadbalancers/%s/sessionpersistence" % utils.get_id(loadbalancer)
        req_body = {"sessionPersistence": {
                "persistenceType": val,
                }}
        resp, body = self.api.method_put(uri, body=req_body)
        return body
Sets the session persistence for the given load balancer.