Sends new spans to Stackdriver Trace or updates existing traces. If the
        name of a trace that you send matches that of an existing trace, new
        spans are added to the existing trace. Attempt to update existing spans
        results undefined behavior. If the name does not match, a new trace is
        created with given set of spans.

        Example:
            >>> from google.cloud import trace_v2
            >>>
            >>> client = trace_v2.Client()
            >>>
            >>> name = 'projects/[PROJECT_ID]'
            >>> spans = {'spans': [{'endTime': '2017-11-21T23:50:58.890768Z',
                                    'spanId': [SPAN_ID],
                                    'startTime': '2017-11-21T23:50:58.890763Z',
                                    'name': 'projects/[PROJECT_ID]/traces/
                                            [TRACE_ID]/spans/[SPAN_ID]',
                                    'displayName': {'value': 'sample span'}}]}
            >>>
            >>> client.batch_write_spans(name, spans)

        Args:
            name (str): Optional. Name of the project where the spans belong.
                The format is ``projects/PROJECT_ID``.
            spans (dict): A collection of spans.
            retry (Optional[google.api_core.retry.Retry]):  A retry object used
                to retry requests. If ``None`` is specified, requests will not
                be retried.
            timeout (Optional[float]): The amount of time, in seconds, to wait
                for the request to complete. Note that if ``retry`` is
                specified, the timeout applies to each individual attempt.

        Raises:
            google.api_core.exceptions.GoogleAPICallError: If the request
                    failed for any reason.
            google.api_core.exceptions.RetryError: If the request failed due
                    to a retryable error and retry attempts failed.
            ValueError: If the parameters are invalid.

def batch_write_spans(self, name, spans, retry=None, timeout=None):
        """
        Sends new spans to Stackdriver Trace or updates existing traces. If the
        name of a trace that you send matches that of an existing trace, new
        spans are added to the existing trace. Attempt to update existing spans
        results undefined behavior. If the name does not match, a new trace is
        created with given set of spans.

        Example:
            >>> from google.cloud import trace_v2
            >>>
            >>> client = trace_v2.Client()
            >>>
            >>> name = 'projects/[PROJECT_ID]'
            >>> spans = {'spans': [{'endTime': '2017-11-21T23:50:58.890768Z',
                                    'spanId': [SPAN_ID],
                                    'startTime': '2017-11-21T23:50:58.890763Z',
                                    'name': 'projects/[PROJECT_ID]/traces/
                                            [TRACE_ID]/spans/[SPAN_ID]',
                                    'displayName': {'value': 'sample span'}}]}
            >>>
            >>> client.batch_write_spans(name, spans)

        Args:
            name (str): Optional. Name of the project where the spans belong.
                The format is ``projects/PROJECT_ID``.
            spans (dict): A collection of spans.
            retry (Optional[google.api_core.retry.Retry]):  A retry object used
                to retry requests. If ``None`` is specified, requests will not
                be retried.
            timeout (Optional[float]): The amount of time, in seconds, to wait
                for the request to complete. Note that if ``retry`` is
                specified, the timeout applies to each individual attempt.

        Raises:
            google.api_core.exceptions.GoogleAPICallError: If the request
                    failed for any reason.
            google.api_core.exceptions.RetryError: If the request failed due
                    to a retryable error and retry attempts failed.
            ValueError: If the parameters are invalid.
        """
        self.trace_api.batch_write_spans(
            name=name, spans=spans, retry=retry, timeout=timeout
        )