<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def mcast_sender(mcgroup=MC_GROUP):
 """Non-object interface for sending multicast messages. """

    sock = socket(AF_INET, SOCK_DGRAM)
    sock.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1)
    if _is_broadcast_group(mcgroup):
        group = '<broadcast>'
        sock.setsockopt(SOL_SOCKET, SO_BROADCAST, 1)
    elif((int(mcgroup.split(".")[0]) > 239) or
         (int(mcgroup.split(".")[0]) < 224)):
        raise IOError("Invalid multicast address.")
    else:
        group = mcgroup
        ttl = struct.pack('b', TTL_LOCALNET)  # Time-to-live
        sock.setsockopt(IPPROTO_IP, IP_MULTICAST_TTL, ttl)
    return sock, group