Lookup optimization and py3k compatilibity

Python 3 `dict.values()` is not a list. To mimetypes lookup faster, I'm using a `set` instead of a `list`.