from register import register_codec def encode(text): text = text.lower() result = "" for char in text: if char.isalpha() or char == " ": if char not in "aeiou": result += char return result.encode("utf8") def decode(data): text = bytes(data).decode("utf8") return text register_codec(encode, decode, "mycodec")