'Execute a set of commands in the Docker container.
The set of commands provided to one call of ``execute`` will be
executed in a single session. This means commands will see the
environment created by previous commands.
The output of the commands is sent to the ``out`` file object,
which must have a ``write`` method.
:param Effect commands: An Effect containing the commands to run,
probably a Sequence of Effects, one for each command to run.
:param out: Where to send command output. Any object with a
``write`` method.
:return int: The exit status of the commands.  If all commands
succeed, this will be zero. If any command fails, this will
be non-zero.'

def execute(self, commands, out=sys.stdout):

    script_file = make_script_file(self.tmpdir, commands)
    script = '/mnt/script/{}'.format(script_file)
    session = self.docker.exec_create(self.container_id, script)
    session_id = session[u'Id']
    for output in self.docker.exec_start(session, stream=True):
        out.write(output)
    return self.docker.exec_inspect(session_id)[u'ExitCode']
