<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def NewTagClass(class_name: str, tag: str = None, bases: Union[type, Iterable] = (Tag, ), **kwargs: Any) -> type: """Generate and return new ``Tag`` class. If ``tag`` is empty, lower case of ``class_name`` is used for a tag name of the new class. ``bases`` should be a tuple of base classes. If it is empty, use ``Tag`` class for a base class. Other keyword arguments are used for class variables of the new class. Example:: MyButton = NewTagClass('MyButton', 'button', (Button,), class_='btn', is_='my-button') my_button = MyButton('Click!') print(my_button.html) """

    if tag is None:
        tag = class_name.lower()
    if not isinstance(type, tuple):
        if isinstance(bases, Iterable):
            bases = tuple(bases)
        elif isinstance(bases, type):
            bases = (bases, )
        else:
            TypeError('Invalid base class: {}'.format(str(bases)))
    kwargs['tag'] = tag
    # Here not use type() function, since it does not support
    # metaclasss (__prepare__) properly.
    cls = new_class(  # type: ignore
        class_name, bases, {}, lambda ns: ns.update(kwargs))
    return cls