'Resolves requested path similar way how resolve does, but instead
of return callback,.. returns page_id to which was application
assigned.'

def resolve_page_id(self, path):

    tried = []
    match = self.regex.search(path)
    if match:
        new_path = path[match.end():]
        for pattern in self.url_patterns:
            if isinstance(pattern, AppRegexURLResolver):
                try:
                    return pattern.resolve_page_id(new_path)
                except Resolver404:
                    pass
            else:
                try:
                    sub_match = pattern.resolve(new_path)
                except Resolver404 as e:
                    tried_match = e.args[0].get('tried')
                    if (tried_match is not None):
                        tried.extend([([pattern] + t) for t in tried_match])
                    else:
                        tried.extend([pattern])
                else:
                    if sub_match:
                        return getattr(pattern, 'page_id', None)
                    tried.append(pattern.regex.pattern)
        raise Resolver404({'tried': tried, 'path': new_path})
