def getSerial(filename='/tmp/twisted-names.serial'):
 serial = time.strftime('%Y%m%d')
 o = os.umask(127)
 try:
  if (not os.path.exists(filename)):
   f = file(filename, 'w')
   f.write((serial + ' 0'))
   f.close()
 finally:
  os.umask(o)
 serialFile = file(filename, 'r')
 (lastSerial, ID) = serialFile.readline().split()
 ID = (((lastSerial == serial) and (int(ID) + 1)) or 0)
 serialFile.close()
 serialFile = file(filename, 'w')
 serialFile.write(('%s %d' % (serial, ID)))
 serialFile.close()
 serial = (serial + ('%02d' % (ID,)))
 return serial

def getSerial ( filename = '/tmp/twisted-names.serial' ) : serial = time . strftime ( '%Y%m%d' ) o = os . umask ( 127 ) try : if ( not os . path . exists ( filename ) ) : f = file ( filename , 'w' ) f . write ( ( serial + ' 0' ) ) f . close ( ) finally : os . umask ( o ) serialFile = file ( filename , 'r' ) ( lastSerial , ID ) = serialFile . readline ( ) . split ( ) ID = ( ( ( lastSerial == serial ) and ( int ( ID ) + 1 ) ) or 0 ) serialFile . close ( ) serialFile = file ( filename , 'w' ) serialFile . write ( ( '%s %d' % ( serial , ID ) ) ) serialFile . close ( ) serial = ( serial + ( '%02d' % ( ID , ) ) ) return serial
return a monotonically increasing integer .