def compile_path(path: str) -> PathCompiledResult:
    """
    Given a path string, like: "/{str:username}"

    regex:      "/(?P<username>[^/]+)"
    format:     "/{username}"
    convertors: {str:"username"}
    """
    duplicated_params = set()
    param_convertors = {}

    parsed_url = urlparse(path)
    query_parameters = parse_qs(parsed_url.query)

    for match in PARAM_REGEX.finditer(path):
        convertor_type, param_name = match.groups("str")
        convertor = convertor_type.rstrip(":")

        if param_name in param_convertors:
            duplicated_params.add(param_name)

        param_convertors[param_name] = STRING_TYPES[convertor.lower()]

    if duplicated_params:
        names = ", ".join(sorted(duplicated_params))
        ending = "s" if len(duplicated_params) > 1 else ""
        raise ValueError(f"Duplicated param name{ending} {names} at path {path}")

    return PathCompiledResult(param_convertors, query_parameters)

    Given a path string, like: "/{str:username}"

    regex:      "/(?P<username>[^/]+)"
    format:     "/{username}"
    convertors: {str:"username"}
    
ninja_extra/controllers/model/path_resolver.py