def notification(subject, body, urgency=None, timeout=None):
    """Function to build notification text and command list"""
    cmds = []

    urgs = {0: "low", 1: "normal", 2: "critical"}
    urg_level = urgs.get(urgency, "normal")
    if urg_level != "normal":
        cmds += ["-u", urg_level]

    if timeout:
        cmds += ["-t", f"{timeout}"]

    cmds += [subject, body]

    text = '<span weight="bold">'
    if urg_level != "normal":
        text += '<span color="{{colour}}">'
    text += "{subject}"
    if urg_level != "normal":
        text += "</span>"
    text += "</span> - {body}"

    text = text.format(subject=subject, body=body)

    return text, cmds
Function to build notification text and command list
test/widgets/test_notify.py