Your code has a subtle bug that you may never be bitten by, but it's best that you avoid it.
You are iterating over a dictionary's keys. The order of iteration is NOT guaranteed by Python. In this case order does matter.
codecs.BOM_UTF32_LE is '\xff\xfe\x00\x00'
codecs.BOM_UTF16_LE is '\xff\xfe'
If your file is encoded in UTF-32LE but UTF-16LE just happens to be tested first, you will incorrectly state that the file is encoded in UTF-16LE.
To avoid this, you can iterate over a tuple that is ordered by BOM-length descending. See sample code in my answer to this question.