Fetch support.

This supersedes #203.

It looks mostly ready so I'm open to suggestions. It misses tests (again :-S) and documentation.
I don't think we should explain what each key means here—we can just list them, and leave the explanation to their individual docstrings.