code: def init(loop=None, hardware: 'HardwareAPILike' = None):
      
  
      app = web.Application(loop=loop, middlewares=[error_middleware])
      if hardware:
          checked_hardware = hardware
      else:
          checked_hardware = opentrons.hardware
      app['com.opentrons.hardware'] = checked_hardware
      app['com.opentrons.rpc'] = RPCServer(app, MainRouter(checked_hardware))
      app['com.opentrons.http'] = HTTPServer(app, CONFIG['log_dir'])
  
      return app
docs: Builds an application and sets up RPC and HTTP servers with it.
  
      :param loop: A specific aiohttp event loop to use. If not specified, the
                   server will use the default event loop.
      :param hardware: The hardware manager or hardware adapter to connect to.
                       If not specified, the server will use
                       :py:attr:`opentrons.hardware`