def _sort_set_none_first(set_):
    """Sort a set, sorting ``None`` before other elements, if present.
    """
    if None in set_:
        set_.remove(None)
        out = [None]
        out.extend(sorted(set_))
        set_.add(None)
        return out
    else:
        return sorted(set_)