def get_account_mapping()

in customizations/AccountFactory/EnrollAccount/enroll_account.py [0:0]


def get_account_mapping(account_email=None, account_id=None):
    '''Return account id for a given email and vice versa'''

    account_name = None

    for acct in list_all_accounts():
        if account_email:
            if acct['Email'] == account_email:
                account_id = acct['Id']
                account_name = acct['Name']
                break
        elif account_id:
            if acct['Id'] == account_id:
                account_name = acct['Name']
                account_email = acct['Email']
                break
        else:
            error_and_continue('Invalid input recieved')

    if not account_name:
        error_and_exit('Unable to find an account with in the organization')

    return(account_id, account_name, account_email)