<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def dump(values):
 """ Dump a ValueTree instance, returning its dict representation. :param values: :type values: ValueTree :return: :rtype: dict """

    root = {}
    def _dump(_values, container):
        for name,value in _values._values.items():
            if isinstance(value, ValueTree):
                container[name] = _dump(value, {})
            elif isinstance(value, list):
                items = []
                for item in value:
                    if not isinstance(item, str):
                        raise ValueError()
                    items.append(item)
                container[name] = items
            elif isinstance(value, str):
                container[name] = value
            else:
                raise ValueError()
        return container
    return _dump(values, root)