code: def EnumVariable(key, help, default, allowed_values, map={}, ignorecase=0):
      
  
      help = '%s (%s)' % (help, '|'.join(allowed_values))
      # define validator
      if ignorecase >= 1:
          validator = lambda key, val, env: \
                      _validator(key, val.lower(), env, allowed_values)
      else:
          validator = lambda key, val, env: \
                      _validator(key, val, env, allowed_values)
      # define converter
      if ignorecase == 2:
          converter = lambda val: map.get(val.lower(), val).lower()
      elif ignorecase == 1:
          converter = lambda val: map.get(val.lower(), val)
      else:
          converter = lambda val: map.get(val, val)
      return (key, help, default, validator, converter)
docs: The input parameters describe an option with only certain values
      allowed. They are returned with an appropriate converter and
      validator appended. The result is usable for input to
      Variables.Add().
  
      'key' and 'default' are the values to be passed on to Variables.Add().
  
      'help' will be appended by the allowed values automatically
  
      'allowed_values' is a list of strings, which are allowed as values
      for this option.
  
      The 'map'-dictionary may be used for converting the input value
      into canonical values (e.g. for aliases).
  
      'ignorecase' defines the behaviour of the validator:
  
          If ignorecase == 0, the validator/converter are case-sensitive.
          If ignorecase == 1, the validator/converter are case-insensitive.
          If ignorecase == 2, the validator/converter is case-insensitive and the converted value will always be lower-case.
  
      The 'validator' tests whether the value is in the list of allowed values. The 'converter' converts input values
      according to the given 'map'-dictionary (unmapped input values are returned unchanged).