def coerce(cls, arg):
        """Given an arg, return the appropriate value given the class."""
        try:
            return cls(arg).value
        except (ValueError, TypeError):
            raise InvalidParameterDatatype("%s coerce error" % (cls.__name__,))
Given an arg, return the appropriate value given the class.