def from_epoll_events(cls, epoll_events):
        """
        Create a :class:`_EpollSelectorEvents` instance out of a bit mask using
        ``EPOLL*`` family of constants.
        """
        self = cls()
        if epoll_events & select.EPOLLIN:
            self |= EVENT_READ
        if epoll_events & select.EPOLLOUT:
            self |= EVENT_WRITE
        # Treat EPOLLHUP specially, as both 'read and write ready' so that on
        # the outside this can be interpreted as EOF
        if epoll_events & select.EPOLLHUP:
            self |= EVENT_READ | EVENT_WRITE
        return self