'If a byte-order mark is present, strip it and return the encoding it implies.'

@classmethod
def strip_byte_order_mark(cls, data):

    encoding = None
    if ((len(data) >= 4) and (data[:2] == '\xfe\xff') and (data[2:4] != '\x00\x00')):
        encoding = 'utf-16be'
        data = data[2:]
    elif ((len(data) >= 4) and (data[:2] == '\xff\xfe') and (data[2:4] != '\x00\x00')):
        encoding = 'utf-16le'
        data = data[2:]
    elif (data[:3] == '\xef\xbb\xbf'):
        encoding = 'utf-8'
        data = data[3:]
    elif (data[:4] == '\x00\x00\xfe\xff'):
        encoding = 'utf-32be'
        data = data[4:]
    elif (data[:4] == '\xff\xfe\x00\x00'):
        encoding = 'utf-32le'
        data = data[4:]
    return (data, encoding)
