<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def to_dict(self, val=UNSET):
 """Creates dict object from dict2 object Args: val (:obj:`dict2`):
 Value to create from Returns: Equivalent dict object. """

        if val is UNSET:
            val = self

        if isinstance(val, dict2) or isinstance(val, dict):
            res = dict()
            for k, v in val.items():
                res[k] = self.to_dict(v)
            return res
        elif isinstance(val, list):
            res = []
            for item in val:
                res.append(self.to_dict(item))
            return res
        else:
            return val