def __init__(self,  monitoring_latency, stats_interval=None,
                 ip_address=None):
        super().__init__(monitoring_latency)
        self.__name = None
        self.__hardware_address = None
        if ip_address is None:
            ip_address = NetworkInterface.__get_active_ip_address()
        self.__ip_address = ip_address
        self.__broadcast_address = None
        self.__subnet_mask = None
        self.__default_route = None
        self.__bytes_sent = 0
        self.__bytes_recv = 0
        # Get interface name, network mask and broadcast address
        if self.__ip_address is not None:
            for interface in nif.interfaces():
                addresses = nif.ifaddresses(interface)
                try:
                    af_inet = addresses[nif.AF_INET][0]
                    if af_inet['addr'] != self.__ip_address:
                        continue
                    af_link = addresses[nif.AF_LINK][0]
                    self.__name = NetworkInterface.__check_interface_name(
                        interface
                    )
                    self.__hardware_address = af_link['addr']
                    self.__broadcast_address = af_inet['broadcast']
                    self.__subnet_mask = af_inet['netmask']
                    break
                except (__HOLE__, KeyError):
                    # ignore interfaces, which don't have MAC or IP
                    continue
        # Get gateway address
        if self.name is not None:
            for gateway_info in nif.gateways()[nif.AF_INET]:
                if self.name in gateway_info:
                    self.__default_route = gateway_info[0]
                    break
        # Prepare to collect statistics
        if stats_interval is None:
            stats_interval = timedelta(hours=1)
        self.__bytes_sent_stats = LimitedTimeTable(stats_interval)
        self.__bytes_recv_stats = LimitedTimeTable(stats_interval)
        # Read updating values at first time
        self._monitoring_action()
        pass

    # endregion

    # region properties
dataset/ETHPy150Open uzumaxy/pyspectator/pyspectator/network.py/NetworkInterface.__init__