Implementation of SELF in python