<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def get_subnet_length(mask):
    '''
    Convenience function to convert the netmask to the CIDR subnet length

    CLI Example:

    .. code-block:: bash

        salt -G 'os_family:Windows' ip.get_subnet_length 255.255.255.0
    '''
    if not salt.utils.validate.net.netmask(mask):
        raise SaltInvocationError(
            '\'{0}\' is not a valid netmask'.format(mask)
        )
    return salt.utils.network.get_net_size(mask)