<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def cost_type(self, cost_type):
 """Sets the cost_type of this TableRateShipping. :param cost_type: The cost_type of this TableRateShipping. :type: str """

        allowed_values = ["orderSubtotal", "weight"]
        if cost_type is not None and cost_type not in allowed_values:
            raise ValueError(
                "Invalid value for `cost_type` ({0}), must be one of {1}"
                .format(cost_type, allowed_values)
            )

        self._cost_type = cost_type