parameters: ()
docstring: Main function
docstring_summary: Main function
docstring_tokens: Main function
function: def main():
      """Main function"""
  
      options = parseCmdLine()
      sessionOptions = createSessionOptions(options)
  
      session = blpapi.Session(sessionOptions)
      try:
          if not session.start():
              print("Failed to start session.")
              return
  
          if not session.openService(INSTRUMENT_SERVICE):
              print(f"Failed to open {INSTRUMENT_SERVICE}")
              return
  
          sendRequest(options, session)
          waitForResponse(session, options.requestType)
      finally:
          session.stop()
function_tokens: def main ( ) : options = parseCmdLine ( ) sessionOptions = createSessionOptions ( options ) session = blpapi . Session ( sessionOptions ) try : if not session . start ( ) : print ( "Failed to start session." ) return if not session . openService ( INSTRUMENT_SERVICE ) : print ( f"Failed to open {INSTRUMENT_SERVICE}" ) return sendRequest ( options , session ) waitForResponse ( session , options . requestType ) finally : session . stop ( )