'Uploads a model persisted in the `target_dir` to s3.'

def save_tar(self, target_dir):

    if (not os.path.isdir(target_dir)):
        raise ValueError(u"Target    directory    '{}'    not    found.".format(target_dir))
    base_name = os.path.basename(target_dir)
    base_dir = os.path.dirname(target_dir)
    tarname = shutil.make_archive(base_name, u'gztar', root_dir=base_dir, base_dir=base_name)
    filekey = os.path.basename(tarname)
    self.s3.Object(self.bucket_name, filekey).put(Body=open(tarname, u'rb'))
