code: def as_device(self):
          
          if self.node_type != NodeType.DEVICE:
              raise ValueError(
                  'Cannot convert to `Device`, node_type is not a device.')
          return self._origin.Device(self._data)
docs: Convert to a `Device` object.
  
          `node_type` must be `NodeType.DEVICE`.