def get_sg_members(server_name, session_id, sg_uuid):
    sg_members = []

    # Create filter to obtain live VMs and VMs that belong in specified
    # the service group.
    sg_filter = {'live': 'TRUE',
                 'serviceGroupIds' : sg_uuid}

    url = "/v310/vm"

    r = tintri.api_get_query(server_name, url, sg_filter, session_id)
    print_debug("The JSON response of the get invoke to the server " +
                server_name + " is: " + r.text)
    
    # if HTTP Response is not 200 then raise an error
    if r.status_code != 200:
        print_error("The HTTP response for the get invoke to the server " +
              server_name + " is not 200, but is: " + str(r.status_code))
        print_error("url = " + url)
        print_error("response: " + r.text)
        tintri.api_logout(server_name, session_id)
        sys.exit(-10)
    
    member_paginated_result = r.json()
    num_members = int(member_paginated_result["filteredTotal"])
    if num_members == 0:
        print_debug("No Service Groups members present")
        return sg_members
    
    print_debug(str(num_members) + " Service Group Members present")
    
    # For each live VM, create a VM info object
    items = member_paginated_result["items"]
    for vm in items:
        if not vm["isLive"]:
            continue
        member_vm = vm["vmware"]["name"]
        member_vmstore = vm["vmstoreName"]
        member_vm_uuid = vm["uuid"]["uuid"]
        print_debug("   " + member_vm + " (" + member_vmstore + ")")

        vm_info = VmInfo(member_vm, member_vm_uuid, member_vmstore)
        sg_members.append(vm_info)

    return sg_members
r = tintri.api_get(server_name, '/info')
json_info = r.json()

print_info("API Version: " + json_info['preferredVersion'])

# Login to VMstore
session_id = tintri.api_login(server_name, user_name, password)

# Create filter to get the oldest user generated snapshot
q_filter = {'queryType': 'TOP_DOCS_BY_TIME',
            'limit': '1',
            'type': 'USER_GENERATED_SNAPSHOT'}

# Get the oldest user generated snapshot
url = "/v310/snapshot"
r = tintri.api_get_query(server_name, url, q_filter, session_id)
print_debug("The JSON response of the get invoke to the server " +
            server_name + " is: " + r.text)

# if HTTP Response is not 200 then raise an exception
if r.status_code != 200:
    print_error("The HTTP response for the get invoke to the server " +
          server_name + " is not 200, but is: " + str(r.status_code))
    print_error("url = " + url)
    print_error("response: " + r.text)
    tintri.api_logout(server_name, session_id)
    sys.exit(-10)

snapshot_result = r.json()
number_of_snapshots = int(snapshot_result["filteredTotal"])
print_debug("Number of Snapshots fetched from get Snapshots call to the server " +
json_info = r.json()

print_info("API Version: " + json_info['preferredVersion'])

# Login to VMstore
session_id = tintri.api_login(server_name, user_name, password)

# Get a VM to work with
p_filter = {
    'limit': 1,
    'sortedBy': 'LATENCY',
    'sortOrder': 'DESC',
    'live': "TRUE"
}
url = "/v310/vm"
r = tintri.api_get_query(server_name, url, p_filter, session_id)
if r.status_code != 200:
    print_error("The HTTP response for the get invoke to the server " +
                server_name + " is not 200, but is: " + str(r.status_code))
    print_error("URL = " + url)
    print_error("response: " + r.text)
    tintri.api_logout(server_name, session_id)
    sys.exit(-10)

vm_paginated_result = r.json()
items = vm_paginated_result['items']
vm = items[0]
vm_uuid = vm['uuid']['uuid']
vm_name = vm['vmware']['name']
print_info("VM: " + vm_name + " : " + vm_uuid + " " + str(vm['isLive']))