def check_condition()

in Onboarding/AWS/Utils.py [0:0]


def check_condition(trust_policy_document: Dict[str, Dict], predicate) -> bool:
    for statement in trust_policy_document.get('Statement', []):
        effect = statement.get('Effect', '')
        if effect != 'Allow':
            continue

        conditions = statement.get('Condition', {})
        if predicate(conditions):
            return True
    return False