python factory practice