<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def add(self, name, value, unit=None):
 """Add symbolic link to Dynamic Number list. name -- name of the symbolic link value -- value of the link (if not a string, conversion is done with str()) unit -- if value is a numerical value, a unit can be added to invoke the \unit{}{} LaTeX command """

        # check if unit provided
        if unit is not None:
            add_unit = True
            unit = str(unit)
        else:
            add_unit = False

        # convert value to string
        value = str(value)

        # write to file
        f = open(self.file_dir, 'a')
        if add_unit:
            f.write("\\pgfkeys{dynamicnumber/%s/%s = \unit{%s}{%s}}\n" % (self.name, name, value, unit))
        else:
            f.write("\\pgfkeys{dynamicnumber/%s/%s = %s}\n" % (self.name, name, value))
        f.close()