Please write the algorithm for the sieve of Eratosthenes in Python code.