Make the compute file from the self.vardict and self.vardictformat

def make_compute_file(self):
        """
        Make the compute file from the self.vardict and self.vardictformat
        """
        string = ""
        try:
            vardict_items = self.vardict.iteritems()
        except AttributeError:
            vardict_items = self.vardict.items()
        for key, val in vardict_items:
            # get default
            default_format = get_default_format(val)
            string_format = "\\newcommand{{\\{}}}{{" + self.vardictformat.get(
                key, default_format) + "}}\n"
            string += string_format.format(key, val).replace("+", "")
        # get settings
        compute_file = open(
            "{root_dir}{os_sep}{name}{os_extsep}{ext}".format(
                root_dir=ROOT_DIR, os_sep=os.sep, os_extsep=os.extsep,
                name=SETTINGS["COMPUTE"]["name"],
                ext=SETTINGS["COMPUTE"]["extension"]
            ), "wb")
        compute_file.write(string)
        compute_file.close()