'Checks whether group has the specified port range permission
(ip_protocol, from_port, to_port, cidr_ip) defined'

def has_permission(self, group, ip_protocol, from_port, to_port, cidr_ip):

    for rule in group.rules:
        if (rule.ip_protocol != ip_protocol):
            continue
        if (int(rule.from_port) != from_port):
            continue
        if (int(rule.to_port) != to_port):
            continue
        cidr_grants = [g for g in rule.grants if (g.cidr_ip == cidr_ip)]
        if (not cidr_grants):
            continue
        return True
    return False
