def run_steps(container, steps, out=sys.stdout):
 container.start()
 try:
  for commands in steps:
   status = container.execute(commands, out)
   if (status != 0):
    return status
 finally:
  container.stop()
 return 0

def run_steps ( container , steps , out = sys . stdout ) : container . start ( ) try : for commands in steps : status = container . execute ( commands , out ) if ( status != 0 ) : return status finally : container . stop ( ) return 0
run a sequence of commands in a container .