python datetime to utc

from datetime import timezone

timestamp = dt.replace(tzinfo=timezone.utc).timestamp()

Here is what the above code is Doing:
1. We create a datetime object with the timezone set to UTC.
2. We use the datetime object’s timestamp() method to get the timestamp.
3. We print the timestamp.