def interfaces4(all=False):
 out = {}
 for (name, addrs) in interfaces(all=all).items():
  addrs = [addr for (fam, addr) in addrs if (fam == socket.AF_INET)]
  if (addrs or all):
   out[name] = addrs
 return out

def interfaces4 ( all = False ) : out = { } for ( name , addrs ) in interfaces ( all = all ) . items ( ) : addrs = [ addr for ( fam , addr ) in addrs if ( fam == socket . AF_INET ) ] if ( addrs or all ) : out [ name ] = addrs return out
interfaces4 -> dict as :func:interfaces but only includes ipv4 addresses and the lists in the dictionary only contains the addresses not the family .