def check_publish(publish):
    """ Convert the list of published variables to a set with unique elements.
    """
    if publish is None:
        publish = []
    elif isinstance(publish, str):
        publish = [publish]
    elif isinstance(publish, (list, tuple)):
        pass
    else:
        msg = (
            'The publish keyword should specify a string or a list of strings')
        raise RuntimeError(msg)
    return set(publish)
