async def start(request):
    """
    Begins the session manager for factory calibration, if a session is not
    already in progress, or if the "force" key is specified in the request. To
    force, use the following body:
    {
      "force": true
    }
    :return: The current session ID token or an error message
    """
    global session

    try:
        body = await request.json()
    except json.decoder.JSONDecodeError:
        # Body will be null for requests without parameters (normal operation)
        log.debug("No body in {}".format(request))
        body = {}

    if not session or body.get('force'):
        hardware = hw_from_req(request)
        if body.get('force') and session:
            await release(data={})

        session = SessionManager(hardware)
        res = init_pipette()
        if res:
            status = 201
            data = {'token': session.id, 'pipette': res}
        else:
            session = None
            status = 403
            data = {'message': 'Error, pipette not recognized'}
    else:
        data = {'message': 'Error, session in progress. Use "force" key in'
                           ' request body to override'}
        status = 409
    return web.json_response(data, status=status)
async def start ( request ) : global session try : body = await request . json ( ) except json . decoder . JSONDecodeError : log . debug ( "No body in {}" . format ( request ) ) body = { } if not session or body . get ( 'force' ) : hardware = hw_from_req ( request ) if body . get ( 'force' ) and session : await release ( data = { } ) session = SessionManager ( hardware ) res = init_pipette ( ) if res : status = 201 data = { 'token' : session . id , 'pipette' : res } else : session = None status = 403 data = { 'message' : 'Error, pipette not recognized' } else : data = { 'message' : 'Error, session in progress. Use "force" key in' ' request body to override' } status = 409 return web . json_response ( data , status = status )
Begins the session manager for factory calibration, if a session is not
    already in progress, or if the "force" key is specified in the request. To
    force, use the following body:
    {
      "force": true
    }
    :return: The current session ID token or an error message