@contextmanager<EOL>def create_tarball(tar_paths):
tarballfile = TemporaryFile()<EOL>with tarfile.open(fileobj=tarballfile, mode='<STR_LIT:w>') as archive:<EOL><INDENT>for path_on_system, path_in_tarball in tar_paths.items():<EOL><INDENT>archive.add(path_on_system, arcname=path_in_tarball)<EOL><DEDENT><DEDENT>tarballfile.flush()<EOL>tarballfile.seek(<NUM_LIT:0>)<EOL>try:<EOL><INDENT>yield tarballfile<EOL><DEDENT>finally:<EOL><INDENT>tarballfile.close()<EOL><DEDENT>
Context Manger that creates the tarball of the Docker Context to use for building the image

Parameters
----------
tar_paths dict(str, str)
    Key representing a full path to the file or directory and the Value representing the path within the tarball

Yields
------
    The tarball file