def security_group_rule_exists(security_group, values):
    """
    Indicates whether the specified rule values are already
    defined in the given security group.
    """
    for rule in security_group['rules']:
        is_duplicate = True
        keys = 'group_id', 'cidr', 'from_port', 'to_port', 'protocol'
        for key in keys:
            if rule.get(key) != values.get(key):
                is_duplicate = False
                break
        if is_duplicate:
            return True
    return False
