def _list_to_mqtt_values(values, prefix, num_digits):
  """Transforms a values=['a', 'b', 'c'], prefix='myval', num_digits=4 into a dict
  {
    'myval0000': 'a',
    'myval0001': 'b',
    'myval0002': 'c',
  }
  so it can be sent as telemetry over MQTT, see
  https://thingsboard.io/docs/reference/gateway-mqtt-api/#telemetry-upload-api
  """
  return dict(
    ('{prefix}{index:0>{width}}'.format(prefix=prefix, index=i, width=num_digits), values[i])
    for i in range(len(values))
  )