Telefona gönder: Hamiltonian approach to the dynamics of a chemostat