@gen.coroutine
def VerifyAssetId(client, user_id, device_id, prefix_id, asset_id, has_timestamp):
 try:
  asset_name = IdPrefix.GetAssetName(prefix_id).lower()
  if has_timestamp:
   (truncated_ts, embedded_device_id, uniquifier) = DeconstructTimestampAssetId(prefix_id, asset_id)
  else:
   (embedded_device_id, uniquifier) = DeconstructAssetId(prefix_id, asset_id)
 except:
  raise InvalidRequestError(('%s id "%s" does not have a valid format.' % (asset_name, asset_id)))
 if (embedded_device_id != device_id):
  device = (yield gen.Task(Device.Query, client, user_id, embedded_device_id, None, must_exist=False))
  if (device is None):
   raise PermissionError(('User %d and device %d do not have permission to create %s "%s".' % (user_id, device_id, asset_name, asset_id)))
 if (uniquifier.server_id is not None):
  raise PermissionError(('Clients do not have permission to create %s "%s".' % (asset_name, asset_id)))

@ gen . coroutine def VerifyAssetId ( client , user_id , device_id , prefix_id , asset_id , has_timestamp ) : try : asset_name = IdPrefix . GetAssetName ( prefix_id ) . lower ( ) if has_timestamp : ( truncated_ts , embedded_device_id , uniquifier ) = DeconstructTimestampAssetId ( prefix_id , asset_id ) else : ( embedded_device_id , uniquifier ) = DeconstructAssetId ( prefix_id , asset_id ) except : raise InvalidRequestError ( ( '%s id "%s" does not have a valid format.' % ( asset_name , asset_id ) ) ) if ( embedded_device_id != device_id ) : device = ( yield gen . Task ( Device . Query , client , user_id , embedded_device_id , None , must_exist = False ) ) if ( device is None ) : raise PermissionError ( ( 'User %d and device %d do not have permission to create %s "%s".' % ( user_id , device_id , asset_name , asset_id ) ) ) if ( uniquifier . server_id is not None ) : raise PermissionError ( ( 'Clients do not have permission to create %s "%s".' % ( asset_name , asset_id ) ) )
verifies that "asset_id" conforms to the following requirements: 1 .