'Returns (<has-bom>, <bom>, <bom-encoding>). Examples:
(True, \'\xef\xbb\xbf\', "utf-8")
(True, \'\xff\xfe\', "utf-16-le")
(False, None, None)'

def _get_bom_info(self):

    boms_and_encodings = [(codecs.BOM_UTF32_LE, 'utf-32-le'), (codecs.BOM_UTF32_BE, 'utf-32-be'), (codecs.BOM_UTF8, 'utf-8'), (codecs.BOM_UTF16_LE, 'utf-16-le'), (codecs.BOM_UTF16_BE, 'utf-16-be')]
    head_4 = self._accessor.head_4_bytes
    for (bom, encoding) in boms_and_encodings:
        if head_4.startswith(bom):
            return (True, bom, encoding)
            break
    else:
        return (False, None, None)
