def METHOD_NAME(
    path: jsonpath_ng.JSONPath,
    path_constraint: jsonpath_ng.JSONPath,
    min_common_prefix_length: int = 1,
) -> Optional[jsonpath_ng.JSONPath]:
    """
    Narrow the `path` with a more specific `path_constraint`.
    e.g. if the path constraints a slice `[*]` and the constraints a
    specific index `[0]`, the `path` will be narrowed down to `[0]`.
    """
    prefix_path = jsonpath_ng.Root()
    common = True
    common_prefix_length = 0
    for p1, p2 in zip_longest(
        jsonpath_parts(path_constraint),
        jsonpath_parts(path),
    ):
        if common and (n := narrow_jsonpath_node(p1, p2)):
            prefix_path = prefix_path.child(n)
            common_prefix_length += 1
        else:
            common = False
            if p2:
                prefix_path = prefix_path.child(p2)
            else:
                break
    if common_prefix_length < min_common_prefix_length:
        return None
    return prefix_path