def METHOD_NAME(
    path: jsonpath_ng.JSONPath, prefix: jsonpath_ng.JSONPath
) -> Optional[jsonpath_ng.JSONPath]:
    path_parts = jsonpath_parts(path, ignore_root=True)
    prefix_parts = jsonpath_parts(prefix, ignore_root=True)
    if len(path_parts) < len(prefix_parts):
        return None
    # check that the path is properly prefixed
    for i, p in enumerate(prefix_parts):
        if p != path_parts[i]:
            return None
    suffix = path_parts[len(prefix_parts) :]
    if suffix:
        return reduce(lambda a, b: a.child(b), suffix)
    return None