Extensible model loading using a more modular resource mechanism 

Hey,

I felt the need to have PyMad load models from more general sources, such as a custom python package. This is why I modified, once again, the model loading mechanism. This time the modification goes much deeper but is also designed a lot better.
The new model loading works as follows:

- resources (files) are loaded via ResourceProvider objects. I have implemented ResourceProviders for couchdb, python package and normal filesystem resources.
- models are located using a ModelLocator object, that can lookup models accessible via a ResourceProvider. This mechanism might be merged with the existing cpymad.service module, but I am not fully sure about this. For now I have modified cpymad.service to use the ModelLocator.

Before this is ready to merge, there are still some open issues:

The couchdb code probably doesn't work yet, as I have no models in a couchdb to test with. On the other hand, from what I saw in the existing code, the couchdb wasn't functional before my modifications either. However, with the new resource mechanism, it should be easier to get it to work.

In the course of the week, I will also modify some docstrings to be more sphinx-friendly.

On my machine, except for test_lhc-b4 and test_survey all of the existing tests in the test/cpymadtest folder are failing with serious runtime errors (such as memory faults) within the Mad-X library. This was already the case on your last master version. One reason might be, that I have no AFS installed at the moment. I haven't checked if there is any version the tests succeed on my machine. Nevertheless, this means, that I cannot verify that the changes in this pull request do not break anything.

Do these tests also fail on your setup? If so, this might be an important issue to fix. If not, I could send you error traces, as I have currently no clue why these errors emerge.

By the way, I have also started a python3 compatibility branch, for which it might be especially important to have the tests fixed before merging (as python3 features incompatible behaviour regarding unicode and binary IO).

If something is unclear, I will be glad to explain it in further detail.

I have placed the cern/resource/* files under a quasi-public domain (CC0) license, such that it is easier to extract them from the project if they prove useful in a different location. For some of the other files, license notices are still missing, I will try to add them in the next days. Should I copy the license notices from other files in the tree as is, meaning the license owner will be CERN? I am not sure whether I am allowed to that. On the other hand I don't know if it makes the "overall" license more complicated if I enter my own name. As far as I'm concerned, I don't care.


Sincerely,

Thomas