def is_route_valid(r):
    """True if argument r is a valid route.

    A route is valid iff
    - it has an cidr of 0.0.0.0/0
    - its state is active
    - it has a gateway or nat id
    """
    return r['DestinationCidrBlock'] == '0.0.0.0/0' and r['State'
        ] == 'active' and ('GatewayId' in r and r['GatewayId'].startswith(
        'igw-') or 'NatGatewayId' in r and r['NatGatewayId'].startswith('nat-')
        )
