def boolean_to_str(src):
    """Encodes a boolean using the canonical lexical representation.

    src
        Anything that can be resolved to a boolean except None, which
        raises ValueError."""
    if src is None:
        raise ValueError("Can't convert None to boolean")
    elif src:
        return "true"
    else:
        return "false"