<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def assign(self, key, value):
 """an alternative method for assigning values to nested DotDict instances. It accepts keys in the form of X.Y.Z. If any nested DotDict instances don't yet exist, they will be created."""

        key_split = key.split('.')
        cur_dict = self
        for k in key_split[:-1]:
            try:
                cur_dict = cur_dict[k]
            except KeyError:
                cur_dict[k] = self.__class__()  # so that derived classes
                                                # remain true to type
                cur_dict = cur_dict[k]
        cur_dict[key_split[-1]] = value