Move checkout to CFFI and add a target directory option

Having it at the python level should also make it easer to extend with more options in the future as needed.
I remember now why I wanted to iterate over the inputs instead of checking for the known keys: if the programmer using this method makes a typo, we will ignore that option instead of complaining, which can cause subtle bugs, as there is no indication that we're ignoring an argument that was passed. I didn't end up doing it as we just have the two things, but when this gets extended, we should raise an exception if we get something we don't recognise as an option.