<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_to_series(self, name, series_type, item):
 """Assign name to item converted to the given series_type."""

        if series_type == "(":
            self.add_def(name + " = _coconut.tuple(" + item + ")")
        elif series_type == "[":
            self.add_def(name + " = _coconut.list(" + item + ")")
        else:
            raise CoconutInternalException("invalid series match type", series_type)