'change the name'

def func(self):

    caller = self.caller
    if (not self.args):
        caller.msg('Usage:    @name    <obj>    =    <newname>[;alias;alias;...]')
        return
    obj = None
    if self.lhs_objs:
        objname = self.lhs_objs[0]['name']
        if objname.startswith('*'):
            obj = caller.player.search(objname.lstrip('*'))
            if obj:
                if self.rhs_objs[0]['aliases']:
                    caller.msg("Players    can't    have    aliases.")
                    return
                newname = self.rhs
                if (not newname):
                    caller.msg('No    name    defined!')
                    return
                if (not (obj.access(caller, 'control') or obj.access(caller, 'edit'))):
                    caller.msg(("You    don't    have    right    to    edit    this    player    %s." % obj))
                    return
                obj.username = newname
                obj.save()
                caller.msg(("Player's    name    changed    to    '%s'." % newname))
                return
        obj = caller.search(objname)
        if (not obj):
            return
    if self.rhs_objs:
        newname = self.rhs_objs[0]['name']
        aliases = self.rhs_objs[0]['aliases']
    else:
        newname = self.rhs
        aliases = None
    if ((not newname) and (not aliases)):
        caller.msg('No    names    or    aliases    defined!')
        return
    if (not (obj.access(caller, 'control') or obj.access(caller, 'edit'))):
        caller.msg(("You    don't    have    the    right    to    edit    %s." % obj))
        return
    if newname:
        obj.name = newname
    astring = ''
    if aliases:
        [obj.aliases.add(alias) for alias in aliases]
        astring = ('    (%s)' % ',    '.join(aliases))
    if obj.destination:
        obj.flush_from_cache(force=True)
    caller.msg(("Object's    name    changed    to    '%s'%s." % (newname, astring)))
