def int32_to_bytes(x):
    """
    Convert an 32 bit int number to little endian 4 byte binary format.
    This helps writing a integer to a binary file.

    :type x: int32
    :param x: number to be converted
    :return: 4 byte binary
    """
    return x.to_bytes(4, 'little')