def escrow_key(key, username, runtype):
    theurl = pref('ServerURL')+"/checkin/"
    serial = GetMacSerial()
    macname = GetMacName()
    mydata=[('serial',serial),('recovery_password',key),('username',username),('macname',macname)]
    mydata=urllib.urlencode(mydata)
    # req = Request(theurl, mydata)
    # try:
    #     response = urlopen(req)
    # except URLError, e:
    #     if hasattr(e, 'reason'):
    #         print 'We failed to reach a server.'
    #         print 'Reason: ', e.reason
    #         has_error = True
    #     elif hasattr(e, 'code'):
    #         print 'The server couldn\'t fulfill the request'
    #         print 'Error code: ', e.code
    #         has_error = True
    cmd = ['/usr/bin/curl', '-fsSL', '--data', mydata, theurl]
    task = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    proc = task.communicate()[0]

    if task.returncode >= 0:
        has_error = True
    else:
        has_error = False
    if has_error:
        plistData = {}
        plistData['recovery_key']=key
        plistData['username']=username
        try:
            FoundationPlist.writePlist(plistData, '/private/var/root/recovery_key.plist')
        except:
            os.makedirs('/usr/local/crypt')
            FoundationPlist.writePlist(plistData, '/private/var/root/recovery_key.plist')

        os.chmod('/private/var/root/recovery_key.plist',0700)
        if runtype=="initial":
            the_command = "/sbin/reboot"
            reboot = subprocess.Popen(the_command,shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE).communicate()[0]

    else:
        ##need some code to read in the json response from the server, and if the data matches, display success message, or failiure message, then reboot. If not, we need to cache it on disk somewhere - maybe pull it out with facter?
        #time to turn on filevault
        #NSLog(u"%s" % fvprefs['ServerURL'])
        ##escrow successful, if the file exists, remove it
        thePlist = '/private/var/root/recovery_key.plist'

        if os.path.exists(thePlist):
            os.remove(thePlist)
        if runtype=="initial":
            the_command = "/sbin/reboot"
            reboot = subprocess.Popen(the_command,shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE).communicate()[0]
dataset/ETHPy150Open grahamgilbert/Crypt/Crypt/FVUtils.py/escrow_key/operator `!=` -> `>=`