def get_cidr(netmask):
    """Convert a netmask to a CIDR."""
    binary_str = ''
    for octet in netmask.split('.'):
        binary_str += bin(int(octet))[2:].zfill(8)
    return str(len(binary_str.rstrip('0')))