Session token must only be updated from response of requests that successfully mutate resource on the 
        server side (write, replace, delete etc) 
        
        :param dict response_result:
        :param dict response_headers:

        :return:
            - None

def set_session_token(self, response_result, response_headers):
        """ 
        Session token must only be updated from response of requests that successfully mutate resource on the 
        server side (write, replace, delete etc) 
        
        :param dict response_result:
        :param dict response_headers:

        :return:
            - None
        """

        ''' there are two pieces of information that we need to update session token- 
        self link which has the rid representation of the resource, and
        x-ms-alt-content-path which is the string representation of the resource'''

        with self.session_lock:
            collection_rid = ''
            collection_name = ''

            try:
                self_link = response_result['_self']

                ''' extract alternate content path from the response_headers 
                (only document level resource updates will have this), 
                and if not present, then we can assume that we don't have to update
                session token for this request'''
                alt_content_path = ''
                alt_content_path_key = http_constants.HttpHeaders.AlternateContentPath
                response_result_id_key = u'id'
                response_result_id = None
                if alt_content_path_key in response_headers:
                    alt_content_path = response_headers[http_constants.HttpHeaders.AlternateContentPath]
                    response_result_id = response_result[response_result_id_key]
                else:
                    return
                collection_rid, collection_name = base.GetItemContainerInfo(self_link, alt_content_path, response_result_id)
         
            except ValueError:
                return
            except:
                exc_type, exc_value, exc_traceback = sys.exc_info()
                traceback.print_exception(exc_type, exc_value, exc_traceback,
                                  limit=2, file=sys.stdout)
                return

            if collection_name in self.collection_name_to_rid:
                ''' check if the rid for the collection name has changed
                this means that potentially, the collection was deleted
                and recreated
                '''
                existing_rid = self.collection_name_to_rid[collection_name]
                if (collection_rid != existing_rid):
                    ''' flush the session tokens for the old rid, and 
                    update the new rid into the collection name to rid map.
                    '''
                    self.rid_to_session_token[existing_rid] = {}
                    self.collection_name_to_rid[collection_name] = collection_rid

            # parse session token
            parsed_tokens = self.parse_session_token(response_headers)

            # update session token in collection rid to session token map
            if collection_rid in self.rid_to_session_token:
                ''' we need to update the session tokens for 'this' collection
                '''
                for id in parsed_tokens:
                    old_session_token = self.rid_to_session_token[collection_rid][id] if id in self.rid_to_session_token[collection_rid] else None
                    if not old_session_token:
                        self.rid_to_session_token[collection_rid][id] = parsed_tokens[id]
                    else:
                        self.rid_to_session_token[collection_rid][id] = parsed_tokens[id].merge(old_session_token)
                    self.collection_name_to_rid[collection_name] = collection_rid
            else:
                self.rid_to_session_token[collection_rid] = parsed_tokens
                self.collection_name_to_rid[collection_name] = collection_rid