<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def capture_guest(userid):
 """Caputre a virtual machine image. Input parameters: :userid: USERID of the guest, last 8 if length > 8 Output parameters: :image_name: Image name that captured """

    # check power state, if down, start it
    ret = sdk_client.send_request('guest_get_power_state', userid)
    power_status = ret['output']
    if power_status == 'off':
        sdk_client.send_request('guest_start', userid)
        # TODO: how much time?
        time.sleep(1)

    # do capture
    image_name = 'image_captured_%03d' % (time.time() % 1000)
    sdk_client.send_request('guest_capture', userid, image_name,
                            capture_type='rootonly', compress_level=6)
    return image_name