def get_chat_start_event(
        self, span_id: Optional[str]
    ) -> Optional[LLMChatStartEvent]:
        """
        Starting with a given span_id, find the first ancestor span with an
        associated LLMChatStartEvent, then return this event.
        """
        if not span_id:
            return None
        elif span_id in self.agent_chat_start_event:
            return self.agent_chat_start_event[span_id]
        else:
            return self.get_chat_start_event(self.span_parent.get(span_id, None))

        Starting with a given span_id, find the first ancestor span with an
        associated LLMChatStartEvent, then return this event.
        
llama-index-integrations/callbacks/llama-index-callbacks-agentops/llama_index/callbacks/agentops/base.py