Switch order of check for callable and string

This is necessary because in `apply_sorting` attribute can be only a string, so by first checking for callable and then string in dehydrate, one can define a callable string, which can then be used both in dehydrate and `apply_sorting`.