def get_invitation()

in src/join_organization.py [0:0]


def get_invitation(_org_client, account_id):
    handshakes = _org_client.list_handshakes_for_organization(Filter={'ActionType': 'INVITE'}).get('Handshakes')
    for handshake in handshakes:
        for party in handshake.get('Parties'):
            if handshake.get('State') == 'OPEN' and party.get('Id') == account_id and party.get('Type') == 'ACCOUNT':
                return handshake.get('Id')