Pure python implementation of magic file detection
