Python port of ML for Hackers from @carljv