Abstract python into classes