Separate licence-detection code into a single routine, with license detection happening in
order of preference (in case there are multiple licenses, they are picked in order
PD < CC0 < CopyrightFree < CC-BY < CC-BY-SA and variants < CC-BY-NC and variants

The most preferred license, in case of multiple licenses, is chosen by passing in to this
routine a string containing all licenses, one per line.

Separating the detecting into a separate function also allow the same routine to be used
if we wish to detect licenses from categories.