Open a temporary file with writable mode in 'pylearn2/utils/image.py'.

Invocating 'file.flush()' for a file opened with read-only mode may
cause the EBADF (Bad file descriptor) error in some environments such
as Mac OS X 10.8.0.

Since the behavior seems to be undefined in the ISO C standard, the
temporary file should be opened with writable mode.

See:
  https://mail.python.org/pipermail/python-bugs-list/2002-June/012231.html
  http://www.opensource.apple.com/source/Libc/Libc-825.40.1/stdio/FreeBSD/fflush.c
Create a temporary file with 'tempfile.mkstemp()'.

To avoid the race condition on versions of Python prior to 2.7, a
temporary file is created by using 'tempfile.mkstemp()' instead of
'tempfile.NamedTemporaryFile()'.
Add a comment about NamedTemporaryFile() to 'pylearn2/utils/image.py'.
Fixed bug in CompositeLayer class and added unit test for it
Merge pull request #919 from bartvm/composite_fix

Fixed bug in CompositeLayer class and added unit test for it
Merge pull request #918 from cvmat/fix_temporary_file

Fix temporary image file creation
Add some missing functions to CompositeLayer

Adapted from the MLP code.
Add missing wrap to layer get_monitoring_channels