def dt_to_decimal(utc):
 if (utc is None):
  return None
 decimal.getcontext().prec = 30
 return (decimal.Decimal(str(calendar.timegm(utc.utctimetuple()))) + (decimal.Decimal(str(utc.microsecond)) / decimal.Decimal('1000000.0')))

def dt_to_decimal ( utc ) : if ( utc is None ) : return None decimal . getcontext ( ) . prec = 30 return ( decimal . Decimal ( str ( calendar . timegm ( utc . utctimetuple ( ) ) ) ) + ( decimal . Decimal ( str ( utc . microsecond ) ) / decimal . Decimal ( '1000000.0' ) ) )
datetime to decimal .