<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_field(self, name, default_value=None):
 """Add a field with an optional default value."""

        self._fields[name] = default_value

        def func(cluster):
            return self.get(name, cluster)

        setattr(self, name, func)