functions and classes for PyRoot