def construct_example(sentence, example_builder):
  """ Construct BERT model.
    Args:
      sentence: sentence to be converted to BERT example.
      example builder: BERT example builder.
      
    Returns:
      inputs: a dict with all features of the input sentence
      example: bert_example object
    """
  keys = ['input_ids', 'input_mask', 'segment_ids']
  example = example_builder.build_bert_example(sentence)

  if example is None:
    raise ValueError("Example couldn't be built.")

  inputs = {key: example.features[key] for key in keys}
  return inputs, example