implement basis structure in python