def GenerateDataPoint(channel, prev=None):
  """Generates a data point given a metadata descriptor and a previous value.

  Args:
    channel: dict, A channel.
    prev: dict, A previous value.
  """
  result = {}
  for field_descr in channel['fields']:
    name = field_descr['name']
    if not prev and 'init' in field_descr:
      result[name] = field_descr['init']
      continue
    prev_value = prev.get(name) if prev else None
    result[name] = field_descr.get('fun', lambda prev: prev)(prev=prev_value)
  return result