import struct


def pack_word(word, big_endian=False):
    """ Packs a 32-bit word into a binary data string.
    """
    endian = ">" if big_endian else "<"
    return struct.pack("%sL" % endian, word)