parameters: (val, enum)
docstring: Checks the the specified value is in the enum object. If it is
      it will return the correctly capitalised version which should be used.
      This is so the script not longer needs to convert to lower / upper case.
      If the value was not in the enum it raises a value error and tells the user
      the values available
      :param val: The value to search for in the enumeration
      :param enum: The enum object to check against.
      :return: The correctly cased val. Otherwise raises a value error.
docstring_summary: Checks the the specified value is in the enum object. If it is
      it will return the correctly capitalised version which should be used.
      This is so the script not longer needs to convert to lower / upper case.
      If the value was not in the enum it raises a value error and tells the user
      the values available
      :param val: The value to search for in the enumeration
      :param enum: The enum object to check against.
      :return: The correctly cased val. Otherwise raises a value error.
docstring_tokens: Checks the the specified value is in the enum object . If it is it will return the correctly capitalised version which should be used . This is so the script not longer needs to convert to lower / upper case . If the value was not in the enum it raises a value error and tells the user the values available : param val : The value to search for in the enumeration : param enum : The enum object to check against . : return : The correctly cased val . Otherwise raises a value error .
function: def _check_value_is_in_enum(val, enum):
      """
      Checks the the specified value is in the enum object. If it is
      it will return the correctly capitalised version which should be used.
      This is so the script not longer needs to convert to lower / upper case.
      If the value was not in the enum it raises a value error and tells the user
      the values available
      :param val: The value to search for in the enumeration
      :param enum: The enum object to check against.
      :return: The correctly cased val. Otherwise raises a value error.
      """
      seen_val_in_enum = False
      enum_known_vals = _get_enum_values(enum_cls=enum)
      lower_string_val = str(val).lower()
  
      for enum_val in enum_known_vals:
  
          if lower_string_val == enum_val.lower():
              # Get the correctly capitalised value so we no longer have to call lower
              val = enum_val
              seen_val_in_enum = True
              break
  
      # Check to see if the value was seen
      if seen_val_in_enum:
          # Return the correctly capitalised value to be set
          return val
      else:
          e_msg = "The user specified value: '" + str(val) + "' is unknown. "
          e_msg += "Known values for " + enum.enum_friendly_name + " are: \n"
          for key in enum_known_vals:
              e_msg += '\'' + key + '\' '
  
          raise ValueError(e_msg)
function_tokens: def _check_value_is_in_enum ( val , enum ) : seen_val_in_enum = False enum_known_vals = _get_enum_values ( enum_cls = enum ) lower_string_val = str ( val ) . lower ( ) for enum_val in enum_known_vals : if lower_string_val == enum_val . lower ( ) : # Get the correctly capitalised value so we no longer have to call lower val = enum_val seen_val_in_enum = True break # Check to see if the value was seen if seen_val_in_enum : # Return the correctly capitalised value to be set return val else : e_msg = "The user specified value: '" + str ( val ) + "' is unknown. " e_msg += "Known values for " + enum . enum_friendly_name + " are: \n" for key in enum_known_vals : e_msg += '\'' + key + '\' ' raise ValueError ( e_msg )