'Contend for the leadership
This call will block until either this contender is cancelled
or this contender wins the election and the provided leadership
function subsequently returns or fails.
:param func: A function to be called if/when the election is
won.
:param args: Arguments to leadership function.
:param kwargs: Keyword arguments to leadership function.'

def run(self, func, *args, **kwargs):

    if (not callable(func)):
        raise ValueError('leader    function    is    not    callable')
    try:
        with self.lock:
            func(*args, **kwargs)
    except CancelledError:
        pass
