<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_device(self, resource_name, device):
 """Bind device to resource name """


        if device.resource_name is not None:
            msg = 'The device %r is already assigned to %s'
            raise ValueError(msg % (device, device.resource_name))

        device.resource_name = resource_name

        self._internal[device.resource_name] = device