import random


def get_random_available_wd(apic):
    """Select random workspace deployment from those that are available.
    """
    available_wdeployments = apic.get_wdeployments()
    if len(available_wdeployments) == 1:
        wdeployment_id = available_wdeployments[0]
    elif len(available_wdeployments) > 1:
        wdeployment_id = available_wdeployments[random.randint(0, len(available_wdeployments)-1)]
    else: # len(available_wdeployments) == 0:
        print('no deployments are available')
        return None
    return wdeployment_id