def _add_file(self, tar, name, contents, mode=DEFAULT_FILE_MODE):
byte_contents = BytesIO(contents.encode('<STR_LIT:utf8>'))<EOL>info = tarfile.TarInfo(name=name)<EOL>info.size = len(contents)<EOL>info.mtime = <NUM_LIT:0><EOL>info.type = tarfile.REGTYPE<EOL>info.mode = int(mode, <NUM_LIT:8>)  <EOL>tar.addfile(tarinfo=info, fileobj=byte_contents)<EOL>
Adds a single file in tarfile instance.

:param tar: tarfile instance
:param name: string representing filename or path
:param contents: string representing file contents
:param mode: string representing file mode, defaults to 644
:returns: None