code: def _get_api_id(self, event_properties):
          
          api_id = event_properties.get("RestApiId")
          if isinstance(api_id, dict) and "Ref" in api_id:
              api_id = api_id["Ref"]
          return api_id
docs: Get API logical id from API event properties.
  
          Handles case where API id is not specified or is a reference to a logical id.