@classmethod<EOL><INDENT>def from_datetime(self, dt):<DEDENT>
global _last_timestamp<EOL>epoch = datetime(<NUM_LIT>, <NUM_LIT:1>, <NUM_LIT:1>, tzinfo=dt.tzinfo)<EOL>offset = epoch.tzinfo.utcoffset(epoch).total_seconds() if epoch.tzinfo else <NUM_LIT:0><EOL>timestamp = (dt  - epoch).total_seconds() - offset<EOL>node = None<EOL>clock_seq = None<EOL>nanoseconds = int(timestamp * <NUM_LIT>)<EOL>timestamp = int(nanoseconds // <NUM_LIT:100>) + <NUM_LIT><EOL>if clock_seq is None:<EOL><INDENT>import random<EOL>clock_seq = random.randrange(<NUM_LIT:1> << <NUM_LIT>)  <EOL><DEDENT>time_low = timestamp & <NUM_LIT><EOL>time_mid = (timestamp >> <NUM_LIT:32>) & <NUM_LIT><EOL>time_hi_version = (timestamp >> <NUM_LIT>) & <NUM_LIT><EOL>clock_seq_low = clock_seq & <NUM_LIT><EOL>clock_seq_hi_variant = (clock_seq >> <NUM_LIT:8>) & <NUM_LIT><EOL>if node is None:<EOL><INDENT>node = getnode()<EOL><DEDENT>return pyUUID(fields=(time_low, time_mid, time_hi_version,<EOL>clock_seq_hi_variant, clock_seq_low, node), version=<NUM_LIT:1>)<EOL>
generates a UUID for a given datetime

:param dt: datetime
:type dt: datetime
:return: