'Convenience method to create a new Enum class.
`names` can be:
* A string containing member names, separated either with spaces or
commas.  Values are auto-numbered from 1.
* An iterable of member names.  Values are auto-numbered from 1.
* An iterable of (member name, value) pairs.
* A mapping of member name -> value.'

def _create_(cls, class_name, names=None, module=None, type=None):

    if (pyver < 3.0):
        if isinstance(class_name, unicode):
            try:
                class_name = class_name.encode('ascii')
            except UnicodeEncodeError:
                raise TypeError(('%r    is    not    representable    in    ASCII' % class_name))
    metacls = cls.__class__
    if (type is None):
        bases = (cls,)
    else:
        bases = (type, cls)
    classdict = metacls.__prepare__(class_name, bases)
    __order__ = []
    if isinstance(names, basestring):
        names = names.replace(',', '    ').split()
    if (isinstance(names, (tuple, list)) and isinstance(names[0], basestring)):
        names = [(e, (i + 1)) for (i, e) in enumerate(names)]
    for item in names:
        if isinstance(item, basestring):
            (member_name, member_value) = (item, names[item])
        else:
            (member_name, member_value) = item
        classdict[member_name] = member_value
        __order__.append(member_name)
    if (not isinstance(item, basestring)):
        classdict['__order__'] = '    '.join(__order__)
    enum_class = metacls.__new__(metacls, class_name, bases, classdict)
    if (module is None):
        try:
            module = _sys._getframe(2).f_globals['__name__']
        except (AttributeError, ValueError):
            pass
    if (module is None):
        _make_class_unpicklable(enum_class)
    else:
        enum_class.__module__ = module
    return enum_class
