<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def write(self,f):
 """ write the regularization section to an open file handle Parameters f : file handle """

        f.write("* regularization\n")
        for vline in REG_VARIABLE_LINES:
            vraw = vline.strip().split()
            for v in vraw:
                v = v.replace("[",'').replace("]",'')
                if v not in self.optional_dict.keys():
                    raise Exception("RegData missing attribute {0}".format(v))
                f.write("{0} ".format(self.__getattribute__(v)))
            f.write("\n")