def list_vm(client, resource_group_name=None):
    """
    Returns a list of VMware virtual machines in the current subscription.
    If resource group is specified, only the virtual machines
    in that resource group would be listed.
    """
    if resource_group_name is None:
        return client.list_by_subscription()
    return client.list_by_resource_group(resource_group_name)