def METHOD_NAME(input_examples):
    # Create triplets for a [(label, sentence), (label, sentence)...] dataset
    # by using each example as an anchor and selecting randomly a
    # positive instance with the same label and a negative instance with a different label
    triplets = []
    label2sentence = defaultdict(list)
    for inp_example in input_examples:
        label2sentence[inp_example.label].append(inp_example)
    for inp_example in input_examples:
        anchor = inp_example
        if len(label2sentence[inp_example.label]) < 2: #We need at least 2 examples per label to create a triplet
            continue
        positive = None
        while positive is None or positive.guid == anchor.guid:
            positive = random.choice(label2sentence[inp_example.label])
        negative = None
        while negative is None or negative.label == anchor.label:
            negative = random.choice(input_examples)
        triplets.append(InputExample(texts=[anchor.texts[0], positive.texts[0], negative.texts[0]]))
    return triplets