Refactor DBcore without changing behaviour

This PR contains some of the refactoring from #919. It extends the `Type` API and clearly separates responsibilities. The new API allows us to remove a lot of similar code.

For a review I suggest to first look at the final [`types.py`](https://github.com/geigerzaehler/beets/blob/dbcore-refactor/beets/dbcore/types.py) file and the changes in the [model implementation](https://github.com/sampsyo/beets/pull/959/files#diff-1), modulo the changes in 19d3ca822ef539ac99ec9143d97e625c34c94516. This will get you an overview of the goal. Then each commit should be reviewed. The changes are atomic and should leave the behaviour of the program unchanged.
Nit: I like to use `bytes` instead of `str` for clarity in situations like this (it's just an alias on Python 2).