def toOneOf( value, converters, name="" ):
   savedError = None

   if name:
      name = " '%s'" % name

   # Try each converter
   for cvt in converters:
      try:
         result = cvt( value )
         return result
      except Exception, e:
         if not savedError:
            savedError = e

         # Ignore the error.

   msg = "Error trying to convert the input argument%s.  None of the valid " \
         "input converters was successful.\n" % name

   if savedError:
      msg += "The first error encountered was: " + str( savedError )

   raise Exception( msg )

#===========================================================================
: Convert a value to a OneOf object.
dataset/ETHPy150Open nasa/mplStyle/mplStyle/types/convert/toOneOf.py/toOneOf