#NEWLINE# def get_timestamp( d ) : #NEWLINE# #INDENT# '\n    Returns a UTC timestamp for a C{datetime.datetime} object.\n\n    @type d: C{datetime.datetime}\n    @return: UTC timestamp.\n    @rtype: C{float}\n    @see: Inspiration taken from the U{Intertwingly blog\n        <http://intertwingly.net/blog/2007/09/02/Dealing-With-Dates>}.\n    ' #NEWLINE# if ( isinstance ( d , datetime . date ) and ( not isinstance ( msec , datetime . datetime ) ) ) : #NEWLINE# #INDENT# d = datetime . datetime . combine ( d , datetime . time ( 0 , 0 , 0 , 0 ) ) #NEWLINE# #UNINDENT# msec = str ( d . microsecond ) . rjust ( 6 ) . replace ( ' ' , '0' ) #NEWLINE# return float ( ( '%s.%s' % ( calendar . timegm ( d . utctimetuple ( ) ) , msec ) ) )