def __contains__(self, other):
        if isinstance(other, BaseIP):
            if self._module.version != other._module.version:
                return False

            # self_net will contain only the network bits.
            shiftwidth = self._module.width - self._prefixlen
            self_net = self._value >> shiftwidth
            if isinstance(other, IPRange):
                # IPRange has no _value.
                # (self_net+1)<<shiftwidth is not our last address, but the one
                # after the last one.
                return ((self_net << shiftwidth) <= other._start._value and
                        (((self_net + 1) << shiftwidth) > other._end._value))

            other_net = other._value >> shiftwidth
            if isinstance(other, IPAddress):
                return other_net == self_net
            if isinstance(other, IPNetwork):
                return self_net == other_net and self._prefixlen <= other._prefixlen

        # Whatever it is, try to interpret it as IPAddress.
        return IPAddress(other) in self
Check self options.
dataset/ETHPy150Open drkjam/netaddr/netaddr/ip/__init__.py/IPNetwork.__contains__--crossover with--dataset/ETHPy150Open klen/graphite-beacon/graphite_beacon/handlers/smtp.py/SMTPHandler.init_handler