some functions for the canonical basis of a hecke algebra in sagemath, written for affine B2 but can be easily modified for other types