Lookup implementation

PR @zancas's work on lookup. PRs make it easy to do code reviews when new commits are pushed.
Good. I think it would be useful to be able to override this on a per-lookup basis though, so maybe also add a `host_override` variable to `lookup`, that if specified, overrides this one.