code: def get_label(parameter, ptype, flavor=None, mpl=None):
      if flavor is not None:
          if flavor not in ('latex', 'mathml'):
              raise Exception('flavor not recognized: {}'.format(flavor))
      else:
          if mpl is None:
              raise Exception('either the flavor or mpl must be provided')
          rendering = mpl.rcParams['text.usetex']
          if rendering:
              flavor = 'latex'
          else:
              flavor = 'mathml'
      if parameter not in labels:
          raise Exception('parameter not known')
      if ptype not in labels[parameter]:
          raise Exception('ptype not known')
      if flavor not in labels[parameter][ptype]:
          raise Exception('flavor not known')
      return labels[parameter][ptype][flavor]