IP addressing, CIDR, and subnets
An IPv4 address is a 32-bit number written as four decimal bytes. CIDR (classless inter-domain routing) notation such as 192.168.10.0/26 gives a network address and a prefix length: the first 26 bits identify the network and the remaining 6 bits identify a host inside it. The netmask is the same idea as a bit pattern: 26 ones followed by 6 zeros is 255.255.255.192.
Python
import ipaddress
network = ipaddress.ip_network("192.168.10.0/26")
print(network.netmask, network.num_addresses)
hosts = list(network.hosts())
print(hosts[0], hosts[-1], len(hosts))
print(ipaddress.ip_address("192.168.10.70") in network)
subnets = list(ipaddress.ip_network("192.168.10.0/24").subnets(new_prefix=26))
print([str(subnet) for subnet in subnets])