docs: def get_trace_id(request):
      """Gets the trace id based on a request. If not present with the request,
      create a custom (depending on config: `zipkin.trace_id_generator`) or a
      completely random trace id.
  
      :param: current active pyramid request
      :returns: a 64-bit hex string
      """
      if 'X-B3-TraceId' in request.headers:
          trace_id = _convert_signed_hex(request.headers['X-B3-TraceId'])
          # Tolerates 128 bit X-B3-TraceId by reading the right-most 16 hex
          # characters (as opposed to overflowing a U64 and starting a new trace).
          trace_id = trace_id[-16:]
      elif 'zipkin.trace_id_generator' in request.registry.settings:
          trace_id = _convert_signed_hex(request.registry.settings[
              'zipkin.trace_id_generator'](request))
      else:
          trace_id = generate_random_64bit_string()
  
      return trace_id