in ec2stack/providers/cloudstack/security_groups.py [0:0]
def _find_rule(rule, rule_type):
"""
Searches a Cloudstack response for a rule and returns its Id.
@param rule: Rule to be found.
@param rule_type: Type of rule.
@return: Id of the rule.
"""
security_group = _get_security_group(rule)
if rule_type in security_group:
found_rules = security_group[rule_type]
for found_rule in found_rules:
if _compare_rules(rule, found_rule):
return found_rule['ruleid']
errors.invalid_permission()