def maxID(db):
 now = intTime(1000)
 for tbl in ('cards', 'notes'):
  now = max(now, (db.scalar(('select max(id) from %s' % tbl)) or 0))
 return (now + 1)

def maxID ( db ) : now = intTime ( 1000 ) for tbl in ( 'cards' , 'notes' ) : now = max ( now , ( db . scalar ( ( 'select max(id) from %s' % tbl ) ) or 0 ) ) return ( now + 1 )
return the first safe id to use .