<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def process(self, request):
 """ """

        # if we're not visible we return since we don't need to do anymore processing
        self.check(request)
        if not self.visible:
            return

        # evaluate our title
        if callable(self.title):
            self.title = self.title(request)

        # if no title is set turn it into a slug
        if self.slug is None:
            # in python3 we don't need to convert to unicode, in python2 slugify
            # requires a unicode string
            if sys.version_info > (3, 0):
                self.slug = slugify(self.title)
            else:
                self.slug = slugify(unicode(self.title))

        # evaluate children
        if callable(self.children):
            children = list(self.children(request))
        else:
            children = list(self.children)

        for child in children:
            child.parent = self
            child.process(request)

        self.children = [
            child
            for child in children
            if child.visible
        ]
        self.children.sort(key=lambda child: child.weight)

        # if we have no children and MENU_HIDE_EMPTY then we are not visible and should return
        hide_empty = getattr(settings, 'MENU_HIDE_EMPTY', False)
        if hide_empty and len(self.children) == 0:
            self.visible = False
            return

        # find out if one of our children is selected, and mark it as such
        curitem = None
        for item in self.children:
            item.selected = False

            if item.match_url(request):
                if curitem is None or len(curitem.url) < len(item.url):
                    curitem = item

        if curitem is not None:
            curitem.selected = True