code: def atlasdb_num_peers( con=None, path=None ):
      
      with AtlasDBOpen(con=con, path=path) as dbcon:
  
          sql = "SELECT MAX(peer_index) FROM peers;"
          args = ()
  
          cur = dbcon.cursor()
          res = atlasdb_query_execute( cur, sql, args )
  
          ret = []
          for row in res:
              tmp = {}
              tmp.update(row)
              ret.append(tmp)
  
          assert len(ret) == 1
  
      return ret[0]['MAX(peer_index)']
docs: How many peers are there in the db?