code: def is_valid(cls, arg):
          
          return (isinstance(arg, (int, long)) and (arg >= 0)) or \
              isinstance(arg, basestring)
docs: Return True if arg is valid value for the class.  If the string
          value is wrong for the enumeration, the encoding will fail.