'Extract the given file to a temporarily and return
the path of the directory with the extracted content.'

def extract(self, filename):

    prefix = ('django_%s_template_' % self.app_or_project)
    tempdir = tempfile.mkdtemp(prefix=prefix, suffix='_extract')
    self.paths_to_remove.append(tempdir)
    if (self.verbosity >= 2):
        self.stdout.write(('Extracting    %s\n' % filename))
    try:
        archive.extract(filename, tempdir)
        return tempdir
    except (archive.ArchiveException, IOError) as e:
        raise CommandError(("couldn't    extract    file    %s    to    %s:    %s" % (filename, tempdir, e)))
