def mcast_ip(ip_addr, return_tuple=True):
    """
    Function to check if a address is multicast
    Args:
        ip_addr: Multicast IP address in the following format 239.1.1.1
        return_tuple: Set to True it returns a IP, set to False returns True or False

    Returns: see return_tuple for return options

    """
    regex_mcast_ip = __re.compile("^(((2[2-3][4-9])|(23[0-3]))\.((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])))$")
    if return_tuple:
        while not regex_mcast_ip.match(ip_addr):
            print("Not a good multicast IP.")
            print("Please try again.")
            ip_addr = input("Please enter a multicast IP address in the following format x.x.x.x: ")
        return ip_addr
    elif not return_tuple:
        if not regex_mcast_ip.match(ip_addr):
            return False
        else:
            return True
Function to check if a address is multicast
    Args:
        ip_addr: Multicast IP address in the following format 239.1.1.1
        return_tuple: Set to True it returns a IP, set to False returns True or False

    Returns: see return_tuple for return options