<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def add_subset(self, name, constants):
 """Add a subset of entries under a defined name. This allow to defined a "sub choice" if a django field need to not have the whole choice available. The sub-choice is a new ``Choices`` instance, with only the wanted the constant from the main ``Choices`` (each "choice entry" in the subset is shared from the main ``Choices``) The sub-choice is accessible from the main ``Choices`` by an attribute having the given name. Parameters name : string Name of the attribute that will old the new ``Choices`` instance. constants: list or tuple List of the constants name of this ``Choices`` object to make available in the subset. Returns ------- Choices The newly created subset, which is a ``Choices`` object Example ------- [('ONLINE', 1, 'Online'), ('DRAFT', 2, 'Draft'), ('OFFLINE', 3, 'Offline')] [('DRAFT', 2, 'Draft'), ('OFFLINE', 3, 'Offline')] 2 True Traceback (most recent call last):
 AttributeError: 'Choices' object has no attribute 'ONLINE' Raises ------ ValueError * If ``name`` is already an attribute of the ``Choices`` instance. * If a constant is not defined as a constant in the ``Choices`` instance. """


        # Ensure that the name is not already used as an attribute.
        if hasattr(self, name):
            raise ValueError("Cannot use '%s' as a subset name. "
                             "It's already an attribute." % name)

        subset = self.extract_subset(*constants)

        # Make the subset accessible via an attribute.
        setattr(self, name, subset)
        self.subsets.append(name)