add translate method for container to get transpiled code

when I use the transpiler as a library, I only want the result, not to write files.
This should include a type signature for the return value.