def on_receive_request_vote_response(self, data):
        """Receives response for vote request.
        If the vote was granted then check if we got majority and may become Leader
        """

        if data.get('vote_granted'):
            self.vote_count += 1

            if self.state.is_majority(self.vote_count):
                self.state.to_leader()
def on_receive_request_vote_response ( self , data ) : if data . get ( 'vote_granted' ) : self . vote_count += 1 if self . state . is_majority ( self . vote_count ) : self . state . to_leader ( )
Receives response for vote request.
        If the vote was granted then check if we got majority and may become Leader