It wasn't a direct port of the Python one. Instead I mostly followed the guide and looked at the Python code when something was unclear to me. Nim being statically typed meant I had to create many MalTypes instead of just using the built in Python ones. But nothing particularly challenging.
Now that I think about it, I could have used implicit converters to make it look more like Python, but that would probably lead to confusion.