def build_sdk_span(self, span):
        """ Takes a BasicSpan and converts into an SDK type JsonSpan """

        custom_data = CustomData(tags=span.tags,
                                 logs=self.collect_logs(span))

        sdk_data = SDKData(name=span.operation_name,
                           custom=custom_data,
                           Type=self.get_span_kind_as_string(span))

        if "arguments" in span.tags:
            sdk_data.arguments = span.tags["arguments"]

        if "return" in span.tags:
            sdk_data.Return = span.tags["return"]

        data = Data(service=instana.singletons.agent.sensor.options.service_name, sdk=sdk_data)
        entity_from = {'e': instana.singletons.agent.from_.pid,
                      'h': instana.singletons.agent.from_.agentUuid}

        json_span = JsonSpan(
                             t=span.context.trace_id,
                             p=span.parent_id,
                             s=span.context.span_id,
                             ts=int(round(span.start_time * 1000)),
                             d=int(round(span.duration * 1000)),
                             k=self.get_span_kind_as_int(span),
                             n="sdk",
                             f=entity_from,
                             data=data)

        error = span.tags.pop("error", False)
        ec = span.tags.pop("ec", None)

        if error and ec:
            json_span.error = error
            json_span.ec = ec

        return json_span
Takes a BasicSpan and converts into an SDK type JsonSpan