What follows is a document describing the LZW encoder algorithm: "1. Find out the set of all single characters appearing in input string and initialize the dictionary with an entry for each of them, mapping to themselves (e.g. "abhhe" -> { "a": "a", "b": "b", "h": "h", "e": "e" }). 2. Repeatedly search for the longest prefix substring of the remaining input string that is in the dictionary. 3. Append the token mapped to, of the prefix found in step 2, by the dictionary, into the output list. 4. Insert an entry to the dictionary. The key is the prefix found in step 2, string concat with the next character in the input string, and value is a newly generated token (say a 2 digit numeric string). 5. Remove the longest prefix found in step 2 from input string and go back to step 2. 6. Finally, return the output list when input string is empty. (Notice that step 2 to 5 is in a *while* loop.)" Given the info, show me the code in python for LZW encoder. Do not include the following keywords: entry, value, input, *
user