code: def _displaystr2num(st):
      
      num = None
      for s, n in [('DFP-', 16), ('TV-', 8), ('CRT-', 0)]:
          if st.startswith(s):
              try:
                  curnum = int(st[len(s):])
                  if 0 <= curnum <= 7:
                      num = n + curnum
                      break
              except Exception:
                  pass
      if num is not None:
          return num
      else:
          raise ValueError('Unrecognised display name: ' + st)
docs: Return a display number from a string