def _get_parent_service_context(self):
    """Get the parent service span context (internal use only).

    This looks for the service span that was created when the service was initialized.

    Args:
        self: The service instance

    Returns:
        Context or None: The parent service context, or None if unavailable
    """
    if not is_tracing_available():
        return None

    # The parent span was created when Traceable was initialized and stored as self._span
    if hasattr(self, "_span") and self._span:
        return trace.set_span_in_context(self._span)

    # If we can't find a stored span, default to current context
    return context_api.get_current()
Get the parent service span context (internal use only).

    This looks for the service span that was created when the service was initialized.

    Args:
        self: The service instance

    Returns:
        Context or None: The parent service context, or None if unavailable
    
src/pipecat/utils/tracing/service_decorators.py