def iterifs(physical=True):
net_files = os.listdir(SYSFS_NET_PATH)<EOL>interfaces = set()<EOL>virtual = set()<EOL>for d in net_files:<EOL><INDENT>path = os.path.join(SYSFS_NET_PATH, d)<EOL>if not os.path.isdir(path):<EOL><INDENT>continue<EOL><DEDENT>if not os.path.exists(os.path.join(path, b"<STR_LIT>")):<EOL><INDENT>virtual.add(d)<EOL><DEDENT>interfaces.add(d)<EOL><DEDENT>if not physical:<EOL><INDENT>ifreqs = array.array("<STR_LIT:B>", b"<STR_LIT:\x00>" * SIZE_OF_IFREQ * <NUM_LIT:30>)<EOL>buf_addr, _buf_len = ifreqs.buffer_info()<EOL>ifconf = struct.pack("<STR_LIT>", SIZE_OF_IFREQ * <NUM_LIT:30>, buf_addr)<EOL>ifconf_res = fcntl.ioctl(sockfd, SIOCGIFCONF, ifconf)<EOL>ifreqs_len, _ = struct.unpack("<STR_LIT>", ifconf_res)<EOL>assert ifreqs_len % SIZE_OF_IFREQ == <NUM_LIT:0>, (<EOL>"<STR_LIT>"<EOL>"<STR_LIT>")<EOL>res = ifreqs.tostring()<EOL>for i in range(<NUM_LIT:0>, ifreqs_len, SIZE_OF_IFREQ):<EOL><INDENT>d = res[i:i+<NUM_LIT:16>].strip(b'<STR_LIT>')<EOL>interfaces.add(d)<EOL><DEDENT><DEDENT>results = interfaces - virtual if physical else interfaces<EOL>for d in results:<EOL><INDENT>yield Interface(d)<EOL><DEDENT>
Iterate over all the interfaces in the system. If physical is
        true, then return only real physical interfaces (not 'lo', etc).