<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def to_carrier(self, span_context, carrier):
 """Inject the SpanContext fields to carrier dict. :type span_context: :class:`~opencensus.trace.span_context.SpanContext` :param span_context: SpanContext object. :type carrier: dict :param carrier: The carrier which holds the trace_id, span_id, options information from a SpanContext. :rtype: dict :returns: The carrier which holds the span context information. """

        carrier[_TRACE_ID_KEY] = str(span_context.trace_id)

        if span_context.span_id is not None:
            carrier[_SPAN_ID_KEY] = str(span_context.span_id)

        carrier[_TRACE_OPTIONS_KEY] = str(
            span_context.trace_options.trace_options_byte)

        return carrier