adapt python