'Helper function to avoid code duplication.
At this point we know destination is a valid location'

def create_exit(self, exit_name, location, destination, exit_aliases=None, typeclass=None):

    caller = self.caller
    string = ''
    exit_obj = caller.search(exit_name, location=location, quiet=True, exact=True)
    if (len(exit_obj) > 1):
        caller.search(exit_name, location=location, exact=True)
        return None
    if exit_obj:
        exit_obj = exit_obj[0]
        if (not exit_obj.destination):
            string = "'%s'    already    exists    and    is    not    an    exit!\nIf    you    want    to    convert    it    "
            string += "to    an    exit,    you    must    assign    an    object    to    the    'destination'    property    first."
            caller.msg((string % exit_name))
            return None
        old_destination = exit_obj.destination
        if old_destination:
            string = ('Exit    %s    already    exists.' % exit_name)
            if (old_destination.id != destination.id):
                exit_obj.destination = destination
                if exit_aliases:
                    [exit_obj.aliases.add(alias) for alias in exit_aliases]
                string += ("    Rerouted    its    old    destination    '%s'    to    '%s'    and    changed    aliases." % (old_destination.name, destination.name))
            else:
                string += '    It    already    points    to    the    correct    place.'
    else:
        if (not typeclass):
            typeclass = settings.BASE_EXIT_TYPECLASS
        exit_obj = create.create_object(typeclass, key=exit_name, location=location, aliases=exit_aliases, report_to=caller)
        if exit_obj:
            exit_obj.destination = destination
            string = ('' if (not exit_aliases) else ('    (aliases:    %s)' % ',    '.join([str(e) for e in exit_aliases])))
            string = ("Created    new    Exit    '%s'    from    %s    to    %s%s." % (exit_name, location.name, destination.name, string))
        else:
            string = ("Error:    Exit    '%s'    not    created." % exit_name)
    caller.msg(string)
    return exit_obj
