<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def remove_scoped_variable(self, scoped_variable_id, destroy=True):
 """Remove a scoped variable from the container state :param scoped_variable_id: the id of the scoped variable to remove :raises exceptions.AttributeError: if the id of the scoped variable already exists """

        if scoped_variable_id not in self._scoped_variables:
            raise AttributeError("A scoped variable with id %s does not exist" % str(scoped_variable_id))

        # delete all data flows connected to scoped_variable
        if destroy:
            self.remove_data_flows_with_data_port_id(scoped_variable_id)

        # delete scoped variable
        self._scoped_variables[scoped_variable_id].parent = None
        return self._scoped_variables.pop(scoped_variable_id)