Longest prefix match routing

Write codeMedium22 minCisco style

Your task

Implement a longest-prefix-match routing table lookup. Given a list of [cidr, next_hop] routes where cidr is an IPv4 prefix like '10.0.0.0/8', and a destination IPv4 address, return the next_hop of the most specific (longest prefix length) matching route. A route matches if (dest & mask) == (network & mask). If no route matches, return 'none'. A '/0' default route matches everything. All addresses are valid IPv4.

Examples

route_lookup(routes: list[list[str]], ip: str) -> str
Example 1
Inputroute_lookup([["0.0.0.0/0", "default"], ["10.0.0.0/8", "r1"], ["10.1.0.0/16", "r2"]], "10.1.2.3")
Output"r2"