def _to_timestamp(union_time: None | datetime.datetime | datetime.timedelta) -> int | None:
    """Translate a datetime or timedelta into a number of seconds since epoch."""
    if isinstance(union_time, datetime.timedelta):
        return int((datetime.datetime.now() + union_time).timestamp())
    elif isinstance(union_time, datetime.datetime):
        return int(union_time.timestamp())
    return None
Translate a datetime or timedelta into a number of seconds since epoch.
cirq-google/cirq_google/engine/abstract_local_processor.py