def create_quali_api_instance(context, logger):
    """
    Get needed attributes from context and create instance of QualiApiHelper
    :param context:
    :param logger:
    :return:
    """
    if hasattr(context, 'reservation') and context.reservation:
        domain = context.reservation.domain
    elif hasattr(context, 'remote_reservation') and context.remote_reservation:
        domain = context.remote_reservation.domain
    else:
        domain = None
    address = context.connectivity.server_address
    token = context.connectivity.admin_auth_token
    if token:
        instance = QualiAPIHelper(address, logger, token=token, domain=domain)
    else:
        instance = QualiAPIHelper(address, logger, username='admin', password='admin', domain=domain)
    return instance