def type_mapping(name):
    """
    Mapping between types name and type integer value.

    .. runpython::
        :showcode:

        from mlprodict.onnxrt.doc.doc_helper import type_mapping
        import pprint
        pprint.pprint(type_mapping(None))
        print(type_mapping("INT"))
        print(type_mapping(2))
    """
    di = dict(FLOAT=1, FLOATS=6, GRAPH=5, GRAPHS=10, INT=2,
              INTS=7, STRING=3, STRINGS=8, TENSOR=4,
              TENSORS=9, UNDEFINED=0, SPARSE_TENSOR=11)
    if name is None:
        return di
    if isinstance(name, str):
        return di[name]
    rev = {v: k for k, v in di.items()}
    return rev[name]