detect view name from environ

def detect_view_name(self, environ: Dict[str, Any]) -> str:
        """ detect view name from environ """
        script_name = environ.get('SCRIPT_NAME', '')
        path_info = environ.get('PATH_INFO', '')
        match = self.urlmapper.lookup(path_info)
        if match is None:
            return None

        splited = match.split_path_info(path_info)
        extra_path_info = splited[1]
        pos_args = []  # type: List[str]

        routing_args = environ.get('wsgiorg.routing_args', ((), {}))
        (cur_pos, cur_named) = routing_args
        new_pos = list(cur_pos) + list(pos_args)
        new_named = match.new_named_args(cur_named)
        environ['wsgiorg.routing_args'] = (new_pos, new_named)
        environ['webdispatch.urlmapper'] = self.urlmapper
        urlgenerator = URLGenerator(environ, self.urlmapper)
        environ['webdispatch.urlgenerator'] = urlgenerator
        environ['SCRIPT_NAME'] = script_name + splited[0]
        environ['PATH_INFO'] = extra_path_info

        return match.name