<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def register_data(self, typename, value):
 """Registers a data product, raising if a product was already registered. :API: public :param typename: The type of product to register a value for. :param value: The data product to register under `typename`. :returns: The registered `value`. :raises: :class:`ProductError` if a value for the given product `typename` is already registered. """

    if typename in self.data_products:
      raise ProductError('Already have a product registered for {}, cannot over-write with {}'
                         .format(typename, value))
    return self.safe_create_data(typename, lambda: value)