def label_from_example(example):
  """Get the "label" from an example.

  Args:
    example: a DeepVariant make_examples output example.

  Returns:
    integer (0, 1, or 2 for regular DeepVariant examples) or None if the
        example has no label.
  """
  val = example.features.feature['label'].int64_list.value
  if val:
    return int(val[0])
  else:
    return None