def delete_guest(userid):
    """ Destroy a virtual machine.

    Input parameters:
    :userid:            USERID of the guest, last 8 if length > 8
    """
    # Check if the guest exists.
    guest_list_info = client.send_request('guest_list')
    # the string 'userid' need to be coded as 'u'userid' in case of py2 interpreter.
    userid_1 = (unicode(userid, "utf-8") if sys.version[0] == '2' else userid)

    if userid_1 not in guest_list_info['output']:
        RuntimeError("Userid %s does not exist!" % userid)


    # Delete the guest.
    guest_delete_info = client.send_request('guest_delete', userid)

    if guest_delete_info['overallRC']:
        print("\nFailed to delete guest %s!" % userid)
    else:
        print("\nSucceeded to delete guest %s!" % userid)
Destroy a virtual machine.

    Input parameters:
    :userid:            USERID of the guest, last 8 if length > 8