code: def device_id_partition_keygen(request_envelope):
      # type: (RequestEnvelope) -> str
      
      try:
          device_id = request_envelope.context.system.device.device_id
          return device_id
      except AttributeError:
          raise PersistenceException("Couldn't retrieve device id from "
                                     "request envelope, for partition key use")
docs: Retrieve device id from request envelope, to use as partition key.
  
      :param request_envelope: Request Envelope passed during skill
          invocation
      :type request_envelope: ask_sdk_model.RequestEnvelope
      :return: Device Id retrieved from request envelope
      :rtype: str
      :raises: :py:class:`ask_sdk_core.exceptions.PersistenceException`