<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def archive(self, request, id):
 """Create an archive of a gist The files in the gist are downloaded and added to a compressed archive (tarball). If the ID of the gist was c78d925546e964b4b1df, the resulting archive would be, c78d925546e964b4b1df.tar.gz The archive is created in the directory where the command is invoked. Arguments: request: an initial request object id: the gist identifier """

        gist = self.send(request, id).json()

        with tarfile.open('{}.tar.gz'.format(id), mode='w:gz') as archive:
            for name, data in gist['files'].items():
                with tempfile.NamedTemporaryFile('w+') as fp:
                    fp.write(data['content'])
                    fp.flush()
                    archive.add(fp.name, arcname=name)