<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _datetime_to_pb_timestamp(when):
 """Convert a datetime object to a Timestamp protobuf. :type when: :class:`datetime.datetime` :param when: the datetime to convert :rtype: :class:`google.protobuf.timestamp_pb2.Timestamp` :returns: A timestamp protobuf corresponding to the object. """

    ms_value = _microseconds_from_datetime(when)
    seconds, micros = divmod(ms_value, 10 ** 6)
    nanos = micros * 10 ** 3
    return timestamp_pb2.Timestamp(seconds=seconds, nanos=nanos)