IPv4 CIDR firewall allowlist
Your task
Implement an IPv4 firewall allowlist. Given a list of CIDR blocks (strings like '10.0.0.0/8' or a bare '192.168.1.5' meaning /32) and a candidate IPv4 address string, return True if the address falls inside ANY of the CIDR blocks. Parse dotted-quad addresses to 32-bit integers yourself; for a block a.b.c.d/n, the address matches if its top n bits equal the block's top n bits. A /0 block matches everything. You may use the ipaddress module is NOT required, implement the masking directly.
Examples
ip_allowed(cidrs: list[str], ip: str) -> boolExample 1
Input
ip_allowed(["10.0.0.0/8", "192.168.1.0/24"], "10.5.4.3")Output
True