def ip_mask(ip_addr_and_mask, return_tuple=True):
    """
    Function to check if a address and CIDR mask is good
    Args:
        ip_addr_and_mask: IP address and mask in the following format 192.168.1.1/24
        return_tuple: Set to True it returns a IP and mask in a tuple, set to False returns True or False

    Returns: see return_tuple for return options

    """
    regex_ip_and_mask = __re.compile("^((25[0-5])|(2[0-4][0-9])|(1[0-9][0-9])|([1-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|(1[0-9][0-9])|([1-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|(1[0-9][0-9])|([1-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|(1[0-9][0-9])|([1-9]?[0-9]))/((3[0-2])|([1-2]?[0-9]))$")
    if return_tuple:
        while not regex_ip_and_mask.match(ip_addr_and_mask):
            print("Not a good IP and CIDR mask combo.")
            print("Please try again.")
            ip_addr_and_mask = input("Please enter a IP address and mask in the follwing format x.x.x.x/x: ")
        ip_cidr_split = ip_addr_and_mask.split("/")
        ip_addr = ip_cidr_split[0]
        cidr = ip_cidr_split[1]
        return ip_addr, cidr
    elif not return_tuple:
        if not regex_ip_and_mask.match(ip_addr_and_mask):
            return False
        else:
            return True