def to_dict(self, copy=False):
        """Convert the struct to a dictionary.

        If `copy == True`, returns a deep copy of the values.

        """
        new_dict = {}
        for attr, value in self:
            if copy:
                value = deepcopy(value)
            new_dict[attr] = value

        return new_dict
def to_dict ( self , copy = False ) : new_dict = { } for attr , value in self : if copy : value = deepcopy ( value ) new_dict [ attr ] = value return new_dict
Convert the struct to a dictionary.

        If `copy == True`, returns a deep copy of the values.