code: def require_linklocal(handler):
      
      @functools.wraps(handler)
      async def decorated(request: web.Request) -> web.Response:
          ipaddr_str = request.headers.get('x-host-ip')
          invalid_req_data = {
              'error': 'bad-interface',
              'message': f'The endpoint {request.url} can only be used from '
              'local connections'
          }
          if not ipaddr_str:
              return web.json_response(
                  data=invalid_req_data,
                  status=403)
          try:
              addr = ipaddress.ip_address(ipaddr_str)
          except ValueError:
              LOG.exception(f"Couldn't parse host ip address {ipaddr_str}")
              raise
  
          if not addr.is_link_local:
              return web.json_response(data=invalid_req_data, status=403)
  
          return await handler(request)
      return decorated
docs: Ensure the decorated is only called if the request is linklocal.
  
      The host ip address should be in the X-Host-IP header (provided by nginx)