def _int_to_enum(value, enum_klass):
 try:
  return enum_klass(value)
 except ValueError:
  return value

def _int_to_enum ( value , enum_klass ) : try : return enum_klass ( value ) except ValueError : return value
convert a numeric value to an intenum member .