import struct


def _doConv(bytestr, bOrder, formatCharacter):
    """Convert byte object of bOrder byteorder to format using formatCharacter
    Return -9999 if unpack raised an error
    """
    # Format string for unpack
    formatStr = bOrder + formatCharacter
    try:
        result = struct.unpack(formatStr, bytestr)[0]
    except:
        result = -9999
    return result