def METHOD_NAME(self, training_example):
    import mitie
    text = training_example.text
    tokens = training_example.get("tokens")
    sample = mitie.ner_training_instance([t.text for t in tokens])
    for ent in training_example.get("entities", []):
        try:
            # if the token is not aligned an exception will be raised
            start, end = MitieEntityExtractor.find_entity(
                    ent, text, tokens)
        except ValueError as e:
            logger.warning("Example skipped: {}".format(str(e)))
            continue
        try:
            # mitie will raise an exception on malicious
            # input - e.g. on overlapping entities
            sample.add_entity(list(range(start, end)), ent["entity"])
        except Exception as e:
            logger.warning("Failed to add entity example "
                           "'{}' of sentence '{}'. Reason: "
                           "{}".format(str(e), str(text), e))
            continue
    return sample