code: def _duration_pb_to_timedelta(duration_pb):
      
      return datetime.timedelta(
          seconds=duration_pb.seconds, microseconds=(duration_pb.nanos / 1000.0)
      )
docs: Convert a duration protobuf to a Python timedelta object.
  
      .. note::
  
          The Python timedelta has a granularity of microseconds while
          the protobuf duration type has a duration of nanoseconds.
  
      :type duration_pb: :class:`google.protobuf.duration_pb2.Duration`
      :param duration_pb: A protobuf duration object.
  
      :rtype: :class:`datetime.timedelta`
      :returns: The converted timedelta object.