def to_header(self, span_context):
        """Convert a SpanContext object to header string.

        :type span_context:
            :class:`~opencensus.trace.span_context.SpanContext`
        :param span_context: SpanContext object.

        :rtype: str
        :returns: A trace context header string in google cloud format.
        """
        trace_id = span_context.trace_id
        span_id = span_context.span_id
        trace_options = span_context.trace_options.trace_options_byte

        header = '{}/{};o={}'.format(
            trace_id,
            span_id,
            int(trace_options))
        return header