def timestamp(self):
    """Return POSIX timestamp as float"""
if self._tzinfo is None:
    return _time.mktime((self.year, self.month, self.day, self.hour, self.
        minute, self.second, -1, -1, -1)) + self.microsecond / 1000000.0
else:
    return (self - _EPOCH).total_seconds()
Python: Converting string to timestamp with microseconds