<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def listen(room):
 """Open a volafile room and start listening to it"""

    def onmessage(m):
        """Print the new message and respond to it."""
        print(m)
        if m.admin or m.nick == r.user.name:
            return
        if "parrot" in m.msg.lower():
            r.post_chat("ayy lmao")
        elif m.msg.lower() in ("lol", "lel", "kek"):
            r.post_chat("*kok")
        else:
            r.post_chat(re.sub(r"\blain\b", "purpleadmin", m.msg, re.I))

    with Room(room) as r:
        r.user.change_nick("DumbParrot")
        r.add_listener("chat", onmessage)
        r.listen()