'Creates a copy of this model class with a new name.
The new class is technically a subclass of the original class, so that
instance and type checks will still work.  For example::
>>> from astropy.modeling.models import Rotation2D
>>> SkyRotation = Rotation2D.rename(\'SkyRotation\')
>>> SkyRotation
<class \'__main__.SkyRotation\'>
Name: SkyRotation (Rotation2D)
Inputs: (\'x\', \'y\')
Outputs: (\'x\', \'y\')
Fittable parameters: (\'angle\',)
>>> issubclass(SkyRotation, Rotation2D)
True
>>> r = SkyRotation(90)
>>> isinstance(r, Rotation2D)
True'

def rename(cls, name):

    if (six.PY2 and isinstance(name, six.text_type)):
        name = name.encode(u'ascii')
    mod = find_current_module(2)
    if mod:
        modname = mod.__name__
    else:
        modname = u'__main__'
    new_cls = type(name, (cls,), {})
    new_cls.__module__ = str(modname)
    if hasattr(cls, u'__qualname__'):
        if (new_cls.__module__ == u'__main__'):
            new_cls.__qualname__ = name
        else:
            new_cls.__qualname__ = u'{0}.{1}'.format(modname, name)
    return new_cls
