BibDocFile: support new magic library

* There are two flavours of the magic library (for file
  format guessing): the original bindings coming with the
  CLI file utilities, and the new python-magic bindings
  wrapping libmagic using ctypes. Support for the new
  library is here introduced (while still allowing for
  the old one).  (closes #1207)

Reviewed-by: Tibor Simko <tibor.simko@cern.ch>