def net_if_stats():
 names = net_io_counters().keys()
 ret = {}
 for name in names:
  (isup, duplex, speed, mtu) = cext_posix.net_if_stats(name)
  if hasattr(_common, 'NicDuplex'):
   duplex = _common.NicDuplex(duplex)
  ret[name] = _common.snicstats(isup, duplex, speed, mtu)
 return ret

def net_if_stats ( ) : names = net_io_counters ( ) . keys ( ) ret = { } for name in names : ( isup , duplex , speed , mtu ) = cext_posix . net_if_stats ( name ) if hasattr ( _common , 'NicDuplex' ) : duplex = _common . NicDuplex ( duplex ) ret [ name ] = _common . snicstats ( isup , duplex , speed , mtu ) return ret
return information about each nic installed on the system as a dictionary whose keys are the nic names and value is a namedtuple with the following fields: - isup: whether the interface is up - duplex: can be either nic_duplex_full .