import random


def get_examples(d, vtk_class, lang, all_values=False, number=5, ):
    """
    For the VTK Class and language return the
     total number of examples and a list of examples.

    :param d: The dictionary.
    :param vtk_class: The VTK Class e.g. vtkActor.
    :param lang: The language, e.g. Cxx.
    :param all_values: True if all examples are needed.
    :param number: The number of values.
    :return: Total number of examples and a list of examples.
    """
    try:
        kv = d[vtk_class][lang].items()
    except KeyError as e:
        # print(f'For the combination {vtk_class} and {lang}, this key does not exist: {e}')
        return None, None
    total = len(kv)
    if len(kv) > number:
        if all_values:
            samples = list(kv)
        else:
            samples = random.sample(list(kv), number)
    else:
        samples = list(kv)

    return total, [f'{s[1]}' for s in samples]